Last active
February 24, 2017 03:08
-
-
Save aaronpdennis/5f24f49de36a5e0bd8e8ce43dbb936e2 to your computer and use it in GitHub Desktop.
script for converting NAD83 shapefiles in subdirectories to WGS84 GeoJSON
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
function shp2geojson() { | |
ogr2ogr -f GeoJSON -s_srs EPSG:4269 -t_srs EPSG:4326 "../../$1.geojson" "$1.shp" | |
} | |
for i in ./*/*.zip; do | |
directory=${i%*.zip} | |
mkdir "$directory" | |
cd "$directory" | |
filename=${directory##*/} | |
unzip "../${filename}.zip" | |
for j in *; do | |
filetype=${j#*.} | |
mv "$j" "${filename}.${filetype}" | |
done | |
pwd | |
ls | |
echo "converting shapefile to geojson" | |
shp2geojson "${filename}" | |
cd ../.. | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment