Opened 3 months ago
Last modified 2 months ago
#5781 new defect
Concave Hull returning multi poly with polygons
Reported by: | latot | Owned by: | pramsey |
---|---|---|---|
Priority: | medium | Milestone: | PostGIS GEOS |
Component: | postgis | Version: | 3.4.x |
Keywords: | Cc: |
Description
Hi, for some reason, in postgis 3.4 ST_ConcaveHull is returning multipolygons.
select ST_ConcaveHull(
ST_COLLECT(
array[
'POLYGON((0 0, 1 0, 1 1, 0 1, 0 0))'::geometry, 'POLYGON((10 10, 11 10, 11 11, 10 11, 10 10))'::geometry
]
), 0
);
MULTIPOLYGON(((0 0,1 0,1 1,0 1,0 0)),((10 10,11 10,11 11,10 11,10 10)))
Well, a collection of polygons is the same to have a multipolygon.
If there is a point or linestring on the data, it computes the polygons right again.
Thx
Change History (4)
comment:2 by , 3 months ago
mmm, I did not test the percent, but will not fix it, testing the same example, while the ratio is lower than ~0.51 we will have a multi poly, is not exclusive of 0 ratio… D:
comment:3 by , 2 months ago
Milestone: | PostGIS 3.4.4 → PostGIS GEOS |
---|
This is 100% a GEOS thing. I'm not Sure precisely how much I care, you could also decompose the polygons to their points (ST_Points) and run that against the concave hull function. Depends on what kind of result you are looking for, if you really want a *polygon* concave hull, rather than a point-wise one.
comment:4 by , 2 months ago
This is due to the current behaviour of the ConcaveHullOfPolygons algorithm in JTS/GEOS. It allows the hull to be eroded past the point where the output is fully connected. In contrast, the ConcaveHull algorithm for points ensures that the output is a single connected polygon. I can't remember why this decision was made - perhaps it was just an oversight. It should be possible to require that the output is fully connected.
I thought this was an issue with the old geos, but looking at a server I have running gives a multipolygon
However passing 0 for shrink percent I'm tempted to say should be illegal, so it's probably treating that as a no op. Maybe we should just prevent 0 from being passed in. For example if I do:
I get:
and shows me visually what I would expect.