3

I created a QGIS project and added some polygon layers from postgis database. I also saved QGIS project on PostGIS database.

I am trying to edit those polygons using QGIS vertex tool but when I try to save my edits I get error message saying:

Errors: ERROR: 1 geometries not changed.
  
  Provider errors:
      PostGIS error while changing geometry values: ERROR:  Geography type does not support MultiSurface

Any idea how can I fix this?

I am using QGIS LTR 3.10. I have primary key column in table and I have edit permissions as database user.

3
  • 3
    Your PostGIS polygons are in geography format, which does not support Multi Surface features. You either have to convert your postgis table from geography to geometry or convert the MultiSurface to polygons. Oct 29, 2021 at 9:36
  • When I check for spatial column it says that it is geometry type. And most of those are multi polygons.
    – DrJacoby
    Oct 29, 2021 at 10:40
  • Hmm it seems to be a very specific issue where MultiSurface can contain both Polygons and MultiPolygons. A solution for you might be somewhere in here: github.com/r-spatial/sf/issues/748. Oct 29, 2021 at 11:44

1 Answer 1

1

I faced the same problem here. It looks like QGIS assumes that geometry type is MultiSurface when your PostGIS table contains more than one type of geometry (ex: MultiPolygon and Polygon). And then QGIS try to save any changes or new row as MultiSurface, but PostGIS doesn't accept or understand this type from QGIS (in my case, I could commit changes, but geometry was not recognized after in PostGIS).

enter image description here

In my case, I converted my Polygons rows to MultiPolygons:

UPDATE table
SET geom = st_multi(st_collectionextract(geom,3))
WHERE ST_GeometryType(geom) = 'ST_Polygon'

With my table having rows only in MultiPolygon type, QGIS, at last, assumes MultiPolygon type (after reboot QGIS).

enter image description here

Another option is add PostGIS layer through Menu Layer, Add PostGIS Layer. In Edit connection, you can mark "Don't resolve type of unrestricted columns (GEOMETRY)". In this case, QGIS will allow you to select the geometry type (Multipolygon, in my case).

enter image description here

Interesting that in QGIS 2.X it doesn't happen. Sometimes I used QGIS 2.18 to edit my PostGIS tables, without this MultiSurface issue. It's a third option.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.