Skip to content

Instantly share code, notes, and snippets.

@whyvez
Created October 17, 2013 15:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save whyvez/7026873 to your computer and use it in GitHub Desktop.
Save whyvez/7026873 to your computer and use it in GitHub Desktop.
Downloads all GeoJSON file recursively from an S3 bucket and appends into one master shp file.
#!/bin/bash
# usage: s3geojson2shp.sh my.bucket.com
# retreive all files from the s3 bucket
aws s3 cp --recursive s3://$1 .
# append .geojson to all files and append into master shp file
for file in *;
do
test ${file%.*} = $file && mv $file $file.geojson
ogr2ogr -f 'ESRI Shapefile' -update -append merged $file.geojson
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment