Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ST_ConcaveHull of MultiPolygon returns disconnected result #3

Open
nbvfgh opened this issue Jan 9, 2025 · 1 comment
Open

ST_ConcaveHull of MultiPolygon returns disconnected result #3

nbvfgh opened this issue Jan 9, 2025 · 1 comment
Labels
bug Something isn't working confirmed libgeos

Comments

@nbvfgh
Copy link
Owner

nbvfgh commented Jan 9, 2025

Considering following MultiPolygon:

SELECT ST_GeomFromText('MULTIPOLYGON (((0 0, 1 0, 2 1, 1 1, 0 0)), 
					((8 2, 8 4, 10 4, 10 2, 8 2)),
					((4 9, 5 9, 5 8, 4 8, 4 9)))');

图片
We calculate its concave shell with ST_ConcaveHull:

ST_ConcaveHull(geom, param_pctconvex, param_allow_holes):
As described in the document, the param_pctconvex controls the concaveness of the computed hull. A value of 0 produces a hull with maximum concaveness (but still a single polygon). And often values between 0.3 and 0.1 produce reasonable results.

CREATE TABLE t1(geom geometry);

INSERT INTO t1 VALUES(ST_GeomFromText('MULTIPOLYGON (((0 0, 1 0, 2 1, 1 1, 0 0),(0 0, 1 1, 2 1, 0 0)), 
		                      ((8 2, 8 4, 10 4, 10 2, 8 2)),
		                      ((4 9, 5 9, 5 8, 4 8, 4 9)))');

SELECT ST_AsText(ST_ConcaveHull(t1, 0)) from t1;

-- expected: { POLYGON(...)}
-- actual  : { MULTIPOLYGON(((0 0,1 0,2 1,1 1,0 0)),((8 2,8 4,10 4,10 2,8 2)),((4 9,5 9,5 8,4 8,4 9)))}

The result of concavehull degenerates into the original input
图片

@nbvfgh nbvfgh added bug Something isn't working confirmed libgeos labels Jan 9, 2025
@nbvfgh
Copy link
Owner Author

nbvfgh commented Jan 9, 2025

bug tracker: libgeos/geos#1212

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working confirmed libgeos
Projects
None yet
Development

No branches or pull requests

1 participant