Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Shell script for merging a bunch of shapefiles into 1
file=merge.shp
SRS=epsg:4326
for i in boundary/**/*.shp
do
if [ ! -e "$file" ]
then
echo "creating $file"
ogr2ogr -t_srs $SRS -f 'ESRI Shapefile' $file $i
else
echo "merging $i into $file"
ogr2ogr -t_srs $SRS -f 'ESRI Shapefile' -update -append $file $i
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment