Task Failed when use --boundary argument calling NodeODM deployed in Docker

Hello folks.

I used the --boundary parameter when calling the NodeODM service deployed in Docker, but the task execution failed.

Docker image: opendronemap/nodeodm:gpu

Task init request formdata options:

[{"name":"boundary","value":"{   \"type\": \"FeatureCollection\",   \"features\": [     {       \"type\": \"Feature\",       \"properties\": {},       \"geometry\": {         \"type\": \"Polygon\",         \"coordinates\": [           [             [               118.0128572448912,               28.50126887426447             ],             [               118.01247468400081,               28.50130002848917             ],             [               118.01148504550815,               28.5018827137279             ],             [               118.0120997254289,               28.50284532387725             ],             [               118.01207040492928,               28.50351902682331             ], \t\t\t[               118.01204689122568,               28.50394794657534             ], \t\t\t[               118.01325225983096,               28.50358009368804             ], \t\t\t[               118.01373554189047,               28.50316731453679             ], \t\t\t[               118.01374797683852,               28.50203030949384             ], \t\t\t[               118.01396506314367,               28.50203525673123             ], \t\t\t[               118.01394932367025,               28.50149287524119             ], \t\t\t[               118.01330708056972,               28.50126511130785             ], \t\t\t[ \t\t\t  118.0128572448912, \t\t\t  28.50126887426447 \t\t\t]           ]         ]       }     }   ] }"}]

Error log:

usage: run.sh [options] <dataset name>
run.py: error: argument --boundary: {   type: FeatureCollection,   features: [     {       type: Feature,       properties: {},       geometry: {         type: Polygon,         coordinates: [           [             [               118.0128572448912,               28.50126887426447             ],             [               118.01247468400081,               28.50130002848917             ],             [               118.01148504550815,               28.5018827137279             ],             [               118.0120997254289,               28.50284532387725             ],             [               118.01207040492928,               28.50351902682331             ], 			[               118.01204689122568,               28.50394794657534             ], 			[               118.01325225983096,               28.50358009368804             ], 			[               118.01373554189047,               28.50316731453679             ], 			[               118.01374797683852,               28.50203030949384             ], 			[               118.01396506314367,               28.50203525673123             ], 			[               118.01394932367025,               28.50149287524119             ], 			[               118.01330708056972,               28.50126511130785             ], 			[ 			  118.0128572448912, 			  28.50126887426447 			]           ]         ]       }     }   ] } is not a valid JSON string.

How should I pass the --boundary parameter?

Hi, this is not a problem with your GeoJSON – it is a quoting bug in NodeODM.

Since NodeODM 3.6.x (libs/odmRunner.js, commit 7328aba, April 2026) every option value is wrapped as "value" for the shell, and all double quotes inside the value are stripped first:

const shQuote = s =>  {
    s = String(s).replace(/"/g, "")
    return `"${s}"`;
}

So ODM receives { type: FeatureCollection, features: [...] } – exactly what your error shows – and --boundary (or any other JSON option) can never be passed inline. I reproduced it with your polygon: same error with current NodeODM master, works after the fix below.

Workarounds right now (no rebuild):

  1. Pass a path instead of the JSON string – a path has no quotes, so it survives. Mount a folder into the container and point boundary at the file:
    docker run ... -v /host/boundaries:/boundaries opendronemap/nodeodm:gpu
    
    task option: {"name":"boundary","value":"/boundaries/area.geojson"}
  2. Or patch NodeODM: replace shQuote in /var/www/libs/odmRunner.js with POSIX single quoting (bind-mount the patched file over it):
    const shQuote = s =>  {
        s = String(s);
        if (os.platform() === "win32"){
            s = s.replace(/"/g, "");
            return `"${s}"`;
        }else{
            // single quotes keep the value literally, incl. the double quotes JSON needs
            return `'${s.replace(/'/g, `'\\''`)}'`;
        }
    }
    

Test with your polygon (fake run.sh using ODM’s own path_or_json_string check):

NodeODM result
master 3.6.2 ... is not a valid JSON string. exit 2
with fix boundary parsed (FeatureCollection, 1 feature), exit 0

Pull request with this change: Keep double quotes in option values (fixes JSON options such as --boundary) by Ghost7K · Pull Request #275 · OpenDroneMap/NodeODM · GitHub – until it is merged and a new opendronemap/nodeodm image is published, workaround 1 is the easiest.

1 Like

I try the two of workarounds, both works.

Thank a lot!:laughing:

1 Like

You are welcome, have a great day.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.