Bug report #2188
Merging of multipolygons fail/issues
|Affected QGIS version:||Regression?:||No|
|Operating System:||All||Easy fix?:||No|
|Pull Request or Patch supplied:||Resolution:||fixed|
|Crashes QGIS or corrupts data:||Copied to github as #:||12248|
This ticket was open after the observations made here
use the "regions" layer you can find in the spatialite sample dataset: you can save it as shapefile and import to postgis. Tested also with other layers, like the "world borders" vector.
a) In postgis and Spatialite (in a multipolygon type of layer), merging adjacent or overlapping features returns
"The union operation would result in a geometry type that is not
compatible with the current layer and therefore is canceled"
b) The same message appear when you try to merge non adjacent or non overlapping features (or features with islands) in shapes
c) With Postgis and spatialite is still possible to merge non adjacent or non overlapping features (or features with islands), but actually in trunk (not in 1.3) it returns errors see #2187
#1 Updated by Marco Hugentobler about 10 years ago
a) is a bug and should be fixed in 25264aa1 (SVN r12328)
b) is most likely in a polygon type layer (not multipolygon)?
The merge of non-adjacent features would result in a multipolygon feature. And most datasources consequently reject multipolygons in polygon layers (e.g. postgis), while shape does not. The editing code cannot know if the datasource allows that or not, so it is rejected.
c) could be a problem that arises if (during commit), features are added before deleted .
#2 Updated by Giovanni Manghi about 10 years ago
a) yes, it works now, but still c) (by the way spatialite seems already fixed, not postgis)
b) so, the bottom line is (please forgive me if I'm saying something stupid): if I have a polygon type shapefile I cannot merge non-adjacent features to obtain a multipolygon feature (just in qgis or is the general rule?), but if export that layer to postgis as multipolygon then I can merge non-adjacent features and export back to shapefile to obtain a multipolygon type one. Right?
I guess that this can be closed then.