Skip to content

pgr_alphaShape sometimes fails (parse error - invalid geometry) #1603

@arneman

Description

@arneman

Describe the bug
pgr_alphaShape sometimes fails with this exception:

QL-Fehler [XX000]: ERROR: parse error - invalid geometry
  Hinweis: "GEOMETRYCOLLECTION(POLYGON(())" <-- parse error at position 30 within geometry
  Wobei: SQL statement "WITH a AS (SELECT 'GEOMETRYCOLLECTION(' || string_agg(textgeom,',') || ')' as geome
        FROM _pgr_alphaShape(delauny_query, $2))
    SELECT ST_GeomFromText(geome) FROM a"
PL/pgSQL function pgr_alphashape(geometry,double precision) line 38 at SQL statement

We had this very weird situation:
Buidling an alphashape for 149 points succeeded, but it fails if we build the alphashape with 148 of the 149 points.

To Reproduce
Insert the points in sample_data.sql and execute the two sql commands at the bottom of the file to see the problem.

Expected behavior
A valid (alpha shape) hull

Sample Data
sample_data.zip

Specifications (please complete the following information):
SELECT version();
PostgreSQL 12.3 (Debian 12.3-1.pgdg100+1) on x86_64-pc-linux-gnu, compiled by gcc (Debian 8.3.0-6) 8.3.0, 64-bit

SELECT postgis_full_version();
POSTGIS="3.0.1 ec2a9aa" [EXTENSION] PGSQL="120" GEOS="3.7.1-CAPI-1.11.1 27a5e771" PROJ="Rel. 5.2.0, September 15th, 2018" GDAL="GDAL 2.4.0, released 2018/12/14" LIBXML="2.9.4" LIBJSON="0.12.1" LIBPROTOBUF="1.3.1" WAGYU="0.4.3 (Internal)" TOPOLOGY RASTER

SELECT pgr_version();
3.0.2

Additional context
Despite the circumstance that we upgraded to pg12 & pgrouting3 only because of the new (easily usable) pgr_alphaShape function: Does this bug only affect Driving_Distance, or is pgr_alphaShape used in other pgr functions, too?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions