I have a series of polygons in a geopackage file of QGIS polygons. Is it possible to transfer the contents of this file to another geopackage that has multipolygons as vector data type? I need to fix this error because I need to merge multiple polygons and I can't do it using the simple source "polygon" geopackage but I need a "multipolygon" geopackage.

  • 1
    You simply need to dissolve based on a suitable attribute, and you'll get multipolygons.
    – Erik
    May 19 '20 at 8:10
  • 3
    gdal.org/programs/ogr2ogr.html ogr2ogr -f gpkg output.gpkg input.gpkg -nlt promote_to_multi. Dissolve does not work if the table has fixed geometry type "polygon" because contraint prevents inserting multipolygons into such table.
    – user30184
    May 19 '20 at 8:16

Open both layers in QGIS and simply Copy&Paste your features from source to target. QGIS converts your polygons automatically and even transforms your CRS if necessary. Then you can select your features in edit mode and merge them (command "Merge selected features").


user30184 posted a programatic response but you will need to know how to use GDAL libraries.

The assumption is that your existing geopackage has geometry type of 'Polygon'. This geometry type does not allow multi-part polygons. A 'Merge selected features' action on a geopackage wit that geometry type will cause QGIS to error when you attempt to save those changes.

eg: could not commit changes to layer AAABBBCCC Errors: ERROR: 1 feature(s) not added - geometry type is not compatible with the current layer.

When creating a new geopackage, you should have created multipolygon geometry type. The way to fix this, is to use the GDAL libary as mentioned by user30184. The only downside is that this method and all other methods are going to create a new file. It would be neater if you could apply the geometry type change to te existing file and just overwrite the existing file, but retain any existing data. (like what happens in some database technologies).

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.