-
-
Save sgibbes/1d1fa58f2d93ebeb4a40161ec01cfff1 to your computer and use it in GitHub Desktop.
Combine all shapefiles in directory, selecting only features where GRID_ID (or DN) is = 1
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 | |
echo "here" | |
DATA=`find . -name '*.shp'` | |
ogr2ogr -a_srs EPSG:4326 merge.shp | |
for i in $DATA | |
do | |
SHP=${i:2:100} | |
FINAL="${SHP/.shp/}" | |
echo $FINAL | |
echo $i | |
ogr2ogr -append -update merge.shp $i -f "Esri Shapefile" -dialect sqlite -sql "SELECT * FROM $FINAL WHERE DN = 1" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment