Bug report #7555
Postgis Multipolygon Errors
Status: | Closed | ||
---|---|---|---|
Priority: | Severe/Regression | ||
Assignee: | - | ||
Category: | Vectors | ||
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 |
Description
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.
Related issues
History
#1 Updated by Regis Haubourg over 11 years ago
Sea also Postgis Multipolygon :: cannot create a feature
A solution would be to let QGIS write in multi geometry type when datasource is detected as multi (line, polygon, point...).
#2 Updated by Jürgen Fischer over 11 years ago
regis Haubourg wrote:
Sea also Postgis Multipolygon :: cannot create a feature
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 st_multi()
.
#3 Updated by Jürgen Fischer over 11 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)
SELECT AddGeometryColumn('foo','geom',25832,'MULTIPOLYGON',2);
- adding the layer (gets detected as 'Multipolygon', ie.
type=MULTIPOLYGON
in 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.
#4 Updated by Denis Rouzaud over 11 years ago
You are right.
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.
#5 Updated by Jürgen Fischer over 11 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.