[postgis-users] PostGIS crash on ST_ConcaveHull

Imre Samu pella.samu at gmail.com
Fri Aug 18 07:39:27 PDT 2023


> Any comment is welcomed.

Hi Zhen,

I've recently tested your example with the "postgis/postgis:15-master"
Docker image
*[GEOS version: 3.13.0dev-CAPI-1.18.0 + PostGIS version: 3.5.0dev
3.4.0rc1-21-g7faeed1d4], *
and it appears that it crashes as well [1].

However, I found that the CGAL-based alternative ST_AlphaShape is working
without issues.   [1]+[2]

postgres=# select ST_AlphaShape('MULTIPOINT ((113.56577197798602
22.80081530883069),(113.565723279387
22.800815316487014),(113.56571548761124
22.80081531771092),(113.56571548780202
22.800815317674463),(113.56577197817877
22.8008153088047),(113.56577197798602 22.80081530883069))'::geometry, 0.75
);

                     st_alphashape

---------------------------------------------------
 010300000001000000070000006288BBAE34645C404AB48F3B02CD364065E369CF34645C4097728A3B02CD36405D9CAB9B35645C405F90693B02CD364059D1AB9B35645C40CC73693B02CD364065E369CF34645C4097728A3B02CD3640D3B
CBBAE34645C40348C8F3B02CD36406288BBAE34645C404AB48F3B02CD3640
(1 row)


[1]
tested with "postgis/postgis:15-master"
https://github.com/postgis/docker-postgis
  POSTGIS="3.5.0dev 3.4.0rc1-21-g7faeed1d4" [EXTENSION] PGSQL="150"
  *GEOS="3.13.0dev-CAPI-1.18.0" SFCGAL="SFCGAL 1.5.0, CGAL 5.6.1,* BOOST
1.74.0" PROJ="9.3.0 NETWORK_ENABLED=OFF
  URL_ENDPOINT=https://cdn.proj.org
USER_WRITABLE_DIRECTORY=/var/lib/postgresql/.local/share/proj
  DATABASE_PATH=/usr/local/share/proj/proj.db" LIBXML="2.9.10"
LIBJSON="0.15" LIBPROTOBUF="1.3.3" WAGYU="0.5.0
  (Internal)" TOPOLOGY

[2]  https://postgis.net/docs/en/ST_AlphaShape.html

*This function effectively computes a concave hull of a geometry in a
similar way to ST_ConcaveHull, but uses CGAL and a different algorithm.*
*Availability: 3.3.0 - requires SFCGAL >= 1.4.1.   ;  This method needs
SFCGAL backend.*

Regards,
  Imre



耳辰 <erchen.cz at alibaba-inc.com> ezt írta (időpont: 2023. aug. 18., P, 15:05):

>
> Hi guys,
>
> I met a postgis crash when tried to use ST_ConvaveHull function with a
> multipoint, in postgis 3.3.2 and Geos 3.11.2 :
>
> select ST_ConcaveHull('MULTIPOINT ((113.56577197798602
> 22.80081530883069),(113.565723279387
> 22.800815316487014),(113.56571548761124
> 22.80081531771092),(113.56571548780202
> 22.800815317674463),(113.56577197817877
> 22.8008153088047),(113.56577197798602 22.80081530883069))', 0.75);
>
> The crash stack are listed:
> #0  0x0000ffff84e02210 in
> geos::triangulate::tri::Tri::getIndex(geos::triangulate::tri::Tri const*)
> const () from /home/erchen.cz/pgsql15/lib/libgeos.so.3.11.2
> #1  0x0000ffff84ce74c0 in
> geos::algorithm::hull::HullTriangulation::nextBorderTri(geos::algorithm::hull::HullTri*)
> ()
>   from /home/erchen.cz/pgsql15/lib/libgeos.so.3.11.2
> #2  0x0000ffff84ce7698 in
> geos::algorithm::hull::HullTriangulation::traceBoundary(geos::triangulate::tri::TriList<geos::algorithm::hull::HullTri>&)
> ()
>   from /home/erchen.cz/pgsql15/lib/libgeos.so.3.11.2
> #3  0x0000ffff84ce79d4 in
> geos::algorithm::hull::HullTriangulation::traceBoundaryPolygon(geos::triangulate::tri::TriList<geos::algorithm::hull::HullTri>&,
> geos::geom::GeometryFactory const*) ()
>   from /home/erchen.cz/pgsql15/lib/libgeos.so.3.11.2
> #4  0x0000ffff84ce1f28 in
> geos::algorithm::hull::ConcaveHull::toGeometry(geos::triangulate::tri::TriList<geos::algorithm::hull::HullTri>&,
> geos::geom::GeometryFactory const*) () from /home/
> erchen.cz/pgsql15/lib/libgeos.so.3.11.2
> #5  0x0000ffff84ce29d4 in geos::algorithm::hull::ConcaveHull::getHull() ()
>   from /home/erchen.cz/pgsql15/lib/libgeos.so.3.11.2
> #6  0x0000ffff8e54818c in GEOSConcaveHull_r ()
>   from /home/erchen.cz/pgsql15/lib/libgeos_c.so.1
> ….
>
> It seemed that geos was failed to triangulate the multipoint and then
> crashed … Is this a bug of geos?
>
> Any comment is welcomed.
> Regards,
>
> Zhen
>
> _______________________________________________
> postgis-users mailing list
> postgis-users at lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/postgis-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20230818/c4e52756/attachment.htm>


More information about the postgis-users mailing list