Skip to content

ST_BuildArea

Returns a geometry that encloses the area formed by the given linework.

Usage

geometry ST_BuildArea(geom: geometry)

Arguments

  • geom (geometry): Input geometry

Description

Treats the input geometry’s edges as linework and assembles them into a polygon or multipolygon. Open rings are closed automatically before assembly. Empty input returns an empty polygon, and polygon or multipolygon input is returned unchanged. If no closed ring can be formed, returns NULL.

Examples

SELECT ST_BuildArea(ST_GeomFromWKT('LINESTRING (0 0, 1 0, 1 1, 0 1, 0 0)'));
┌────────────────────────────────────────────────────────────────────────────┐
│ st_buildarea(st_geomfromwkt(Utf8("LINESTRING (0 0, 1 0, 1 1, 0 1, 0 0)"))) │
│                                  geometry                                  │
╞════════════════════════════════════════════════════════════════════════════╡
│ POLYGON((0 0,0 1,1 1,1 0,0 0))                                             │
└────────────────────────────────────────────────────────────────────────────┘