Last active
June 21, 2024 18:52
-
-
Save glw/9928081 to your computer and use it in GitHub Desktop.
load shapefile into Amazon RDS PostGIS
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
shp2pgsql -s 4326 -d -g the_geom shapefilename.shp shapefilename |psql -U username --password -p 5432 -h reallylonghostnametoamazonaws.com dbname |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I found this gist on google, so I wanted to offer some tips and explanation to other people who want to load a shapefile into PostGIS:
Arguments of the
shp2pgsql
command:-s 4326
: This specifies the SRID (projection) of your shapefile. Use 4326 if your shapefile uses WGS84. But if you are using TIGER shapefiles from the US Census Bureau, you are looking for NAD83 (SRID 4269).-d
: This drops the table and rebuilds it.-g the_geom
: This is what the column with the actual polygon geometry will be named in your tableshapefilename.shp
: This is the filename of your shapefileshapefilename
: This will be the name of the table created with your shapefile data.