I haven't been able to find a solution with the source so am trying to work on the output file. I have also asked this question on SO
I have a large (200MB) geoJSON file that has a lot of complex polygons and multipolygons. A very truncated example is at https://gist.github.com/jinky32/81f61e1fc118822ba103?short_path=d16949b
As you can see this file is comprised of polygons and multipolygons that have a String property of either 1 or 2. Below is an example of how these shapes look on mapshaper.org when highlighting a multipolygon of either value in the same tile (essentially c.90+% of this tile is made up of a multipolygon with one value or the other)
I do not need to differentiate between these different values and polygons / multipolygons with a String value of either 1 or 2 can be combined together which I hope will reduce the file size.
Can anyone advise how I can achieve this – preferably with a cli tool?
Best Answer
That's easy to do with ogr2ogr http://www.gdal.org/ogr2ogr.html and GDAL SQLite dialect http://www.gdal.org/ogr_sql_sqlite.html.
An example using your sample data:
Check the result with ogrinfo:
As you can see there is now only one MultiPolygon feature. Another thing to notice is that if your GeoJSON don't use WGS84 coordinates you should add the CRS object http://geojson.org/geojson-spec.html#coordinate-reference-system-objects.