pgr_pointsAsPolygon
— Draws an alpha shape around given set of points.
Returns the alpha shape as (multi)polygon geometry.
geometry pgr_pointsAsPolygon(text sql [, float8 alpha]);
sql: |
SELECT id, x, y FROM vertex_result;
|
||||||
---|---|---|---|---|---|---|---|
alpha: | (optional) |
Returns a (multi)polygon geometry (with holes).
History
In the following query there is no way to control which point in the polygon is the first in the list, so you may get similar but different results than the following which are also correct.
SELECT ST_AsText(pgr_pointsAsPolygon('SELECT id::integer, ST_X(the_geom)::float AS x, ST_Y(the_geom)::float AS y
FROM edge_table_vertices_pgr'));
st_astext
------------------------------------------------------
POLYGON((2 4,3.5 4,4 3,4 2,4 1,2 0,0 2,0.5 3.5,2 4))
(1 row)
The query use the Sample Data network.