Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

After invoking:

shp2pgsql -W "latin1" theshape.shp > thesql.sql

My console responds with:

Shapefile type: PolygonZ
Postgis type: MULTIPOLYGON[2]

Note the shapefile type is PolygonZ. The result is, I have to manually edit the thesql.sql file and wrap the geometry column in ST_Force_2D() before executing the SQL, otherwise, Postgres complains I'm trying to import a 3D shape into a 2D column.

How can I force dimensionality to 2 with shp2pgsql? Alternatively, can I force it in QGIS?

share|improve this question
up vote 5 down vote accepted
shp2pgsql -t 2D theshape.shp > thesql.sql

For a full list of options you can run

shp2pgsql --help


You'll probably also want to define the projection and throw in a spatial index. You can do so with

shp2pgsql -t 2D -s 4326 -I theshape.shp > thesql.sql

Just replace 4326 with the EPSG code of your coordinate reference system.

share|improve this answer
man shp2pgsql makes no mention of this parameter, whereas shp2pgsql --help does. Thanks. The output from the console is still PolygonZ... which is confusing -- nevertheless, Postgres doesn't complain. Cheers. – Jordan Arseno Apr 12 '13 at 21:50
Nevermind, the PolygonZ indicates the Shapefile type... which makes sense. ;) – Jordan Arseno Apr 12 '13 at 21:53

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.