Skip to content

ST_Polygonize_Agg

Creates polygons from a set of geometries that contain linework representing the edges of a polygon.

Usage

geometry ST_Polygonize_Agg(geom: geometry)

Arguments

  • geom (geometry): Input geometry

Examples

SELECT ST_Polygonize_Agg(geom) FROM (
  VALUES
    (ST_GeomFromText('LINESTRING (0 0, 0 10)')),
    (ST_GeomFromText('LINESTRING (0 10, 10 10)')),
    (ST_GeomFromText('LINESTRING (10 10, 10 0)')),
    (ST_GeomFromText('LINESTRING (10 0, 0 0)'))
) AS t(geom);
┌────────────────────────────────────────────────────────┐
│                st_polygonize_agg(t.geom)               │
│                        geometry                        │
╞════════════════════════════════════════════════════════╡
│ GEOMETRYCOLLECTION(POLYGON((0 0,0 10,10 10,10 0,0 0))) │
└────────────────────────────────────────────────────────┘