Help with a query

Regina Obe lr at pcorp.us
Sun Dec 22 21:12:25 PST 2024


> Hi again
> 
> > I suppose, in the last versions of PostGIS the Function ST_Makevalid
> > will return something other than in the previous one.
> 
> Some information more...
> 
> It seems, in some cases, the function ST_Makevalid returns
> ST_GeometryCollection instead of ST_MultiPolygon...
> Why?!?
> 
> Thanks
> Luca Bertoncello
> (lucabert at lucabert.de)

Yes there have been changes over the years to ST_MakeValid and additional arguments added to control behavior.

How all that works depends on the version of GEOS you are running as well as the PostGIS version.  Most of the ST_MakeValid work is delegated to GEOS, but what is passed on to GEOS is controlled by version of PostGIS.

As you can see noted in the docs -- https://postgis.net/docs/ST_MakeValid.html

The PostGIS 3.2.0 added ability to control algorithm used, but that hinges on if you are running GEOS 3.10 or greater.

It would be also useful if you provided an example of the query you are hitting that returns a Geometry Collection.
In some cases ST_MakeValid would return a geometry collection and I remember that being the case in older versions as well.  That is because ST_MakeValid by default tries to preserve as much linework as was there before as I recall.
Returning a Multipolygon would be invalid in those cases since polygons can't overlap in a Multipolygon.



More information about the postgis-users mailing list