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

5
  • Where does QGIS come into play here? Commented Aug 14, 2019 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. Commented Aug 14, 2019 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 Commented Aug 14, 2019 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 Commented Aug 14, 2019 at 8:45
  • you could try the QGIS DB Manager importer instead Commented Aug 14, 2019 at 13:13

1 Answer 1

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.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.