Created
April 4, 2017 20:56
-
-
Save mappingvermont/27f83b1c8b6c1dee037b05c60901cc89 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