-
Notifications
You must be signed in to change notification settings - Fork 13
Import a Shapefile into PostGIS
Billy Charlton edited this page Jun 30, 2017
·
2 revisions
« Back to Recipes for typical tasks
(This page could use some help!)
PostGIS comes with a tool called shp2pgsql
which reads an ESRI shapefile and creates a .sql file which can be loaded into PostGIS.
- Quick guide is at http://www.bostongis.com/pgsql2shp_shp2pgsql_quickguide.bqg
But, you have to have PostGIS installed on your machine to use the command-line tool. Since PostGIS isn't installed automatically with pgAdmin, and since the Windows port of PostGIS is a little janky, my recommendation is that you copy the needed shapefiles to a folder on the database server, and SSH into the server to run the shp2pgsql
tool.
scp my_shapefile.* sfcta@prospector-db:
ssh sfcta@prospector-db
shp2pgsql -s 4326 -d geo my_shapefile schema.tablename > my_shapefile.sql
psql -U sfcta < my_shapefile.sql
Get Started
- Back-End Setup
- Setting up your development environment
- Building Prospector locally
- Publishing your changes
Other Useful Links
- Recipes for typical tasks
- Glossary
- Publishing instructions for CMP standalone site
- Deploying a new release GitHub Pages and Prospector
Platform Considerations
Background Information