Skip to content

Instantly share code, notes, and snippets.

@pakastin
Created February 15, 2019 11:20
Show Gist options
  • Save pakastin/9d824a6745e6df5d247612f54159658c to your computer and use it in GitHub Desktop.
Save pakastin/9d824a6745e6df5d247612f54159658c to your computer and use it in GitHub Desktop.
#!/bin/bash
consolidated_file="./consolidated.json"
for i in $(find . -name '*.shp'); do
if [ ! -f "$consolidated_file" ]; then
# first file - create the consolidated output file
ogr2ogr -f GeoJSON $consolidated_file -t_srs EPSG:4326 $i
else
# update the output file with new file content
ogr2ogr -f GeoJSON -update -append $consolidated_file -t_srs EPSG:4326 $i
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment