mbloch / mapshaper

Tools for editing Shapefile, GeoJSON, TopoJSON and CSV files
http://mapshaper.org
Other
3.78k stars 535 forks source link

Error on "properties":null where "properties":{} is expected #660

Closed sebastiaan6907 closed 1 month ago

sebastiaan6907 commented 2 months ago

Hi Matthew,

I use the following command: npx mapshaper-xl 24gb perceelgrenzen.geojson -simplify 51% -filter-islands remove-empty -drop fields=id -o precision=0.00001 geojson-type=FeatureCollection perceelgrenzen_simpel.geojson

By using the -drop fields=id I achieve to eliminate all properties for each feature in order to minimise the file size. Mapshaper formats this situation with: "properties":null Where some services, like Mapbox, expect: "properties":{}

Are you able to change mapshaper's notation when there are no properties? Manually editing the simplified 3Gb file is a bit cumbersome.

Regards.

mbloch commented 2 months ago

"properties": null is valid GeoJSON, and mapshaper will continue to use this as the default for features with no data properties. I'm open to adding an option to the -o command to use {} instead of null. We'll need a good name for that option, do you have any suggestions?

sebastiaan6907 commented 2 months ago

-o format brace or -o format curly brace, would be a clear description I would say. And thanks for the quick fix!!

mbloch commented 1 month ago

The latest release has this option.. I named it -o no-null-props