Skip to content

Instantly share code, notes, and snippets.

@glw
Last active August 29, 2015 14:18
Show Gist options
  • Save glw/6fc733c9beaaad462900 to your computer and use it in GitHub Desktop.
Save glw/6fc733c9beaaad462900 to your computer and use it in GitHub Desktop.
shp2pgsql bulk import shpfiles
#Import a directory of shapefiles into postgis as a geometry
#replace EPSG SRID, database, and username, and others if necessary
for f in *.shp;
do
shp2pgsql -s <EPSG SRID> -g geom $f main.${f%.*} | psql -h localhost -p 5432 -d <database> -U <username>;
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment