Supported versions: latest (3.8) 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0 main dev
Unsupported versions:2.6 2.5 2.4 2.3 2.2 2.1 2.0

pgr_alphaShape

pgr_alphaShape — Polygon part of an alpha shape.

Availability

  • Version 3.8.0

    • Deprecated function.

  • Version 3.0.0

    • Breaking change on signature

    • Old signature no longer supported

    • Boost 1.54 & Boost 1.55 are supported

    • Boost 1.56+ is preferable

      • Boost Geometry is stable on Boost 1.56

  • Version 2.1.0

    • Added alpha argument with default 0 (use optimal value)

    • Support to return multiple outer/inner ring

  • Version 2.0.0

    • New official function.

    • Renamed from version 1.x

Migration of pgr_alphaShape

Starting from v3.8.0

Before Deprecation: The following was calculated:

  • An alphaShape was calculated

After Deprecation:

PostGIS has two ways of generating alphaShape.

If you have SFCGAL, which you can install using

CREATE EXTENSION postgis_sfcgal
  • Since PostGIS 3.5+ use CG_AlphaShape

  • For PostGIS 3.5+ use the old name ST_AlphaShape

Other PostGIS options are * ST_ConvexHull * ST_ConcaveHull

Description

Returns the polygon part of an alpha shape.

Characteristics

  • Input is a geometry and returns a geometry

  • Uses PostGis ST_DelaunyTriangles

  • Instead of using CGAL’s definition of alpha it use the spoon_radius

    • spoon_radius=alpha

  • A Triangle area is considered part of the alpha shape when circumcenter radius<spoon_radius

  • The alpha parameter is the spoon radius

  • When the total number of points is less than 3, returns an EMPTY geometry

Boost Graph inside Boost Graph Inside

Signatures

pgr_alphaShape(geometry, [alpha])
RETURNS geometry
Example:

passing a geometry collection with spoon radius 1.5 using the return variable geom

SELECT ST_Area(pgr_alphaShape((SELECT ST_Collect(geom)
      FROM vertices), 1.5));
WARNING:  pgr_alphashape(geometry,double precision) deprecated function on v3.8.0
 st_area
---------
    9.75
(1 row)

Parameters

Parameter

Type

Default

Description

geometry

geometry

Geometry with at least 3 points

alpha

FLOAT

0

The radius of the spoon.

Return Value

Kind of geometry

Description

GEOMETRY COLLECTION

A Geometry collection of Polygons

See Also

Indices and tables