Last active
August 29, 2015 13:56
-
-
Save mhkeller/9096933 to your computer and use it in GitHub Desktop.
Merge a directory of shapefiles into one shapefile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
mkdir merged; | |
for f in *.shp; | |
do | |
if [ -f merged/merged.shp ] | |
printf $f | |
then | |
ogr2ogr -f "ESRI Shapefile" -update -append merged/merged.shp "$f" -nln Merged | |
else | |
ogr2ogr -f "ESRI Shapefile" merged/merged.shp "$f" | |
fi; | |
done; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment