Builds an areal geometry from the constituent lines of the input geometry.
Syntax
geometry ST_BuildArea(geometry a);Parameters
| Parameter | Description |
|---|---|
a | The input geometry. Supported types: LineString, MultiLineString, Polygon, MultiPolygon, and GeometryCollection. |
Description
ST_BuildArea attempts to form a polygon or MultiPolygon from the lines that make up the input geometry. All inner geometries are treated as holes.
The function returns a polygon or MultiPolygon. Returns null if the constituent lines cannot form a closed polygon.
Examples
Build a polygon from a MultiLineString:
SELECT ST_AsText(ST_BuildArea('MultiLineString((0 0,0 1),(0 1,1 1),(1 1,0 0))'::geometry));Output:
st_astext
----------------------------
POLYGON((0 0,0 1,1 1,0 0))
(1 row)该文章对您有帮助吗?