2

I have several single-geometry-layers (geopackages, shapefiles, temporary layers). Some are LineString, others are Polygon. When I use the DBManager in QGIS to import these layers to the PostGIS public schema, I get the error message:

"Geometry type (MultiPolygon) does not match column type (Polygon)."

I know I could export the Layers from QGIS to a Multi-Geometry and than import them to PostGIS, which I did many times. But is there a faster way?

1

1 Answer 1

3

This occurs due to the historic (and poor) decision to allow both multi and single geometries in the same Shapefile. Most database stores don't allow you to mix geometry types in a column so there is a problem importing from shapefiles. The solution is to "promote" all the single features to multi part geometries before importing them.

So to avoid your issue:

  1. Make sure you haven't clicked the Do not promote to multi-part box on the import form.
  2. If you are importing into an existing table make sure that it's geometry column is expecting multi part geometries.
1
  • 1
    I understand that issue for shapefiles. But the error also occurs for geopackage-layers, which are Polygons. And the "Do not promote to multi-part" box is greyed out anyway for me... I don't import into existing tables. I create new PostGIS-tables through the DB Manager import-tool. May 6, 2022 at 10:10

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.