1

I'm trying to import a shapefile into a PostGIS database using the graphical importer. I just installed PostgreSQL, and PostGIS.

The error:

Shapefile type: Polygon

PostGIS type: POLYGON[2]

We have a Multipolygon with 2 parts, can't use -S switch!

Shapefile import failed

After testing that my database worked, I chose the shapefile that I wanted to upload, and then received a message that it had failed to import.

Are there any good tutorials or instructions about how to do this?

PostGIS Shapefile Import Manager

  • Where does QGIS come into play here? – bugmenot123 Aug 14 at 8:16
  • Welcome to GIS SE. As a new user, please take the Tour. Please remember to always include the full error message as text within the body of the Question; this makes it legible on all devices and searchable as well. Please Edit the question. – Vince Aug 14 at 8:34
  • 3
    Sounds like you are trying to force a multipart polygon into a single part with the -S switch. Try without the -S – BERA Aug 14 at 8:38
  • I agree with @BERA , it seems like you try to split the multipolygon. look in options and the checkbox : "generate simple geometries instead of MULTI", uncheck it if checked – Maximilien jaffrès Aug 14 at 8:45
  • you could try the QGIS DB Manager importer instead – ziggy Aug 14 at 13:13
2

I would recommend you to read this shp2pgsql_usage and this tutorial about loading spatial data.

As you see, -S key would try to generate simple geometries instead of MULTI geometries. BUT Will only succeed if all the geometries are actually single. Your case is multipolygon with 2 parts, so do not use -S.

When trying to import Multigeometries, I usually check Generate simple geometries instead of MULTI geometries in the Options (subsection 6 in the tutorial) so import is successful.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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