0

I am attempting to convert a GeoJSON Feature Collection into multiple shapefiles. The shapefile a feature ends up in depends on a specific property of the GeoJSON, layer_id.

My desired output is a single zipped file, containing all the different shapefile folders.

So far I have converted GeoJSON with uniform layer_id to a single shapefile, using the ogr2ogr npm module. The output of the ogr2ogr command is a zipped shapefile.

I would like to either:

  1. Learn how to designate a property for ogr2ogr to "group by" when creating a shapefile, creating multiple shapefiles
  2. Learn how to create unzipped shapefiles with ogr2ogr, which I can then compress into a single zip
2
  • Unzipped shapefile is the default gdal.org/drivers/vector/shapefile.html and creation of zip should require using .shz or .shp.zip as the name of the output.
    – user30184
    May 14 '20 at 14:33
  • @user30184 ah, thanks! It looks like the npm module adds the automatic zipping functionality then. I'll see what I can do about that.
    – Avocado
    May 14 '20 at 14:45
1

Unlike the ogr2ogr command line tool, the ogr2ogr npm module automatically zips shapefiles.

I forked the library and updated the 'ESRI Shapefile' entry in drivers.json, so that the output property has a value of "". This stops the npm module from zipping the directory, and the output is the shapefile directory.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.