2

In a PostGIS table with a geometry column of type 'Geometry' containing MultiLineStrings and MultiPolygons QGIS wants to load these as MultiCurve and MultiSurface layers. When I create a new object on one of these layers it is of type MultiCurve or MultiSurface. However I would like MultiLineStrings and MultiPolygons for compatibility with other processes e.g. filtering objects by geometry type.

I can not change the Spatial Type in the Data Source Manager. I'm running 3.28.1. What can I do to force creation of MultiLineStrings and MultiPolygons instead of MultiCurves and MultiSurfaces?

1 Answer 1

2

I had the same problem : I used a trigger to convert multisurfaces into multipolygons when I create features. For the function :

CREATE FUNCTION myConvert() returns trigger as
&&
BEGIN
 IF st_geometrytype(NEW.geom) like '%surface%' THEN NEW.geom = st_multi(st_curvetoLine(NEW.geom))
 END IF;
END;
&&;

Then create the trigger.

1
  • Nice function. I was using st_curvetoline() manually. I was hoping to do it in QGIS but this at least makes it a lot easier to do in PostGIS. Thanks. Nov 21, 2022 at 16:35

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.