gisgeojsongdalogr2ogrtippecanoe

How to get GDAL/ogr2ogr to output GeoJSON as feature-per-line instead of a formatted FeatureCollection?


I'm trying to convert some Very Big Shapefiles into GeoJSON so that I can run them through tippecanoe and create a .mbtiles to upload to Mapbox Studio for hosting and styling.

I can use ogr2ogr to create my GeoJSON file just fine, however it outputs a FeatureCollection with nice formatting. What I want is a .json file with one feature per line, so that I can use the 'Parallel processing of input' feature of Tippecanoe and speed up creation of my .mbtiles.

Question 1: Is there a way to do this simply with ogr2ogr? I can't seem to find a relevant option in the GDAL GeoJSON driver docs.

Question 2: Alternatively, could ogr2ogr output a GeoJSON text sequence instead of a FeatureCollection file?


Solution

  • You can use ogr2ogr to output a geojson sequence as you suggested in question 2 @craigsnyders:

    ogr2ogr -f GeoJSONSeq -t_srs EPSG:4326 output.json input.shp