mapshaper icon indicating copy to clipboard operation
mapshaper copied to clipboard

How can I use the Nodejs API input params?

Open Rackar opened this issue 1 year ago • 1 comments

Hi, I saw the wiki:

runCommands(commands[, input][, callback])
input An optional JS object containing contents of files referenced by -i command(s), indexed by file name. Input files are read from the filesystem if they are not present in the input argument.

But I didn't find a example for it.

Can I use a JS object as geojson format? What's the -i commands then?

Thank you for your excellent tools.

Rackar avatar Apr 15 '25 15:04 Rackar

Sorry, I just saw your issue. There is an example of passing a data file as a JS string in the documentation for applyCommands(), here: https://github.com/mbloch/mapshaper/wiki/Using-mapshaper-programmatically#applycommands

You could use a GeoJSON object in the same way.

If you still want help with this, I'd be happy to give a more detailed explanation.

mbloch avatar Jul 28 '25 16:07 mbloch