Using shp2pgsql to load shapefiles to postgis & postgresql

shp2pgsql -I -s <SRID> <PATH/TO/SHAPEFILE> <SCHEMA>.<DBTABLE> | psql -U <USER> -d <DBNAME>

shp2pgsql -I -s <SRID> <PATH/TO/SHAPEFILE> <SCHEMA>.<DBTABLE> | psql -h <HOST> -p <PORT> -U <USER> -d <DBNAME>

Real example:

shp2pgsql -I -s 4326 /home/shp/predios_wgs84.shp geodata.geo_predio | psql -h 127.0.0.1 -p 5432 -U sisapp -d libertad_sgm

With another char encodig:
-W [encoding name]: encoding The character encoding of Shape’s attribute column. (default : “UTF-8”)

shp2pgsql -I -s 4326 -W "LATIN1" /home/shp/predios_wgs84.shp geodata.geo_predio | psql -h 127.0.0.1 -p 5432 -U sisapp -d libertad_sgm
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s