Bug report #7555
Postgis Multipolygon Errors
|Affected QGIS version:||master||Regression?:||No|
|Operating System:||Easy fix?:||No|
|Pull Request or Patch supplied:||No||Resolution:||worksforme|
|Crashes QGIS or corrupts data:||No||Copied to github as #:||16497|
When dealing with multipolygon layers, several problems arise, some causing data loss (Postgres provider drops rows before inserting new rows, and all was lost if a constraint error was raised):
- Creating a single polygon as a new feature is impossible:
PostGIS error while adding features: ERROR: Geometry type (Polygon) does not match column type (MultiPolygon)
- No way of splitting a part into several parts (you can split in several features but not in several parts) [maybe not a blocker]
- Severe known bugs when using merge or clip tools that create POLYGON and not MULTIPOLYGON.
#2 Updated by Jürgen Fischer over 7 years ago
regis Haubourg wrote:
A solution would be to let QGIS write in multi geometry type when datasource is detected as multi (line, polygon, point...).
What the dataProvider's
geometryType()? If it is a multitype it should already be processed through
#3 Updated by Jürgen Fischer over 7 years ago
- Status changed from Open to Feedback
Please eloborate. The problem apparently doesn't appear digitizing (single)polygons on a layer like that:
CREATE TABLE foo(id SERIAL)
- adding the layer (gets detected as 'Multipolygon', ie.
type=MULTIPOLYGONin the data source uri)
- Digiziting a (single) polygon
- Cutting the polygon into three polygons
- Merging two unconnected polygons to a multipolygon with two parts.
- Removing a part from the multipolygon
Works fine here.
#5 Updated by Jürgen Fischer over 7 years ago
- Resolution set to worksforme
- Status changed from Feedback to Closed
Denis Rouzaud wrote:
Apparently, the problem I encountered is related to some persistence in the QGIS project. If you recreate (from scratch by sql) a layer changing its geometry from polygon to multipolygon, it stays as polygon in QGIS.
Ok, if you change the table definition you should better re-add the layer - or unexpected things like this might happen.