I'm trying to use mapshaper.org to convert some geojson files to topojson, and I need the identifying properties to be preserved.
Normally this would be done with the -p
flag on the command line, but despite mapshaper having the facility to allow "options from the command line interface", I can't get it to work.
I've tried -p identifier-name
which give the error:
Unknown command: p
…and I've tried I've tried "-p identifier-name"
in quotes following the help examples which give the error:
Unknown output option: -p identifier-name
Update: I've figured out that Mapshaper isn't passing these commands to the normal topojson
tool, it's using them in its own custom command line interface, which is documented here (strangely there don't seem to be any links to this in Mapshaper itself).
In theory I want the option "id-field=nameoffield"
but it doesn't seem to make any difference – all the geojson properties are still appended to the end of the file and the named property is not changed to an identifier.
How can I filter the properties in Mapshaper like I would with the command topojson in.json -o out.json -p prop1,prop2
?
Best Answer
It worked with the following in Mapshaper's "command line options" box on the Export window:
Mapshaper doesn't pass the commands to the normal
topojson
tool, it has its own command line interface which is documented on the Github page here.If there's a link to this on Mapshaper itself, I can't find it, please edit where it is into my answer!
It seems like you need to
drop-table
all the properties to get one to stand alone as an ID field. I can't find any way to preserve multiple properties while removing the others, or to preserve properties' names, but this works for my needs. Output looks like: