GEOSConcaveHull returns null with MultiPolygon

16 views
Skip to first unread message

Shijie li

unread,
Dec 25, 2024, 8:00:00 AM12/25/24
to SpatiaLite Users
I want to try using the GeosConcaveHull function to calculate the concave hull of a polygon, so I have the following query:

WITH mp AS(
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)))'
) geom
)
SELECT GeosConcaveHull(mp.geom, 1,TRUE) from mp;

But it returned NULL, so I used the ST_SsValid function to check if the polygon was valid, and it returned -1.

This MultiPolygon should be valid.

a.fu...@lqt.it

unread,
Dec 25, 2024, 10:04:52 AM12/25/24
to spatiali...@googlegroups.com
I'm sorry,

but once again I cannot confirm your claim.
testing on my own PC:

WITH mp AS(
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)))'
) geom
)
SELECT ST_AsText(GeosConcaveHull(mp.geom, 1,TRUE)) from mp;
------------------
POLYGON((4 9, 5 9, 10 4, 10 2, 1 0, 0 0, 4 9))


and then testing ST_IsValid() on the input MultiPolygon
returns 1 (not -1, that usually means INVALID ARG)

bye Sandro




Shijie li

unread,
Dec 25, 2024, 11:30:20 AM12/25/24
to SpatiaLite Users
Sorry, I ran this query correctly on spatialite. The incorrect result was caused by my improper operation in QGIS.
Reply all
Reply to author
Forward
0 new messages