Created
November 26, 2013 17:19
-
-
Save bennylope/7662274 to your computer and use it in GitHub Desktop.
Convert shapefiles to SQL and import into an existing, named PostgreSQL database with PostGIS extention already installed.
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
for SHAPEFILE in $(find . -name "*.shp") | |
do | |
BASENAME=$(basename $SHAPEFILE .shp) | |
DIRNAME=$(dirname $SHAPEFILE) | |
SQLFILE="${BASENAME}.sql" | |
shp2pgsql -W UTF-8 $SHAPEFILE $BASENAME > "${DIRNAME}/${BASENAME}.sql" | |
psql -d richmond -f "${DIRNAME}/${BASENAME}.sql" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment