Returns the boundary of a geometry object.
Syntax
geometry ST_Boundary(geometry geomA);Parameters
| Parameter | Description |
|---|---|
geomA | The input geometry object. |
Usage notes
ST_Boundarysupports 3D geometries and preserves Z coordinates in the output.
Examples
Point input — returns an empty GeometryCollection:
SELECT ST_AsText(ST_Boundary('POINT(1 0)'::geometry)); st_astext
------------------------
GEOMETRYCOLLECTION EMPTY
(1 row)LineString input — returns a MultiPoint containing the endpoints:
SELECT ST_AsText(ST_Boundary('LINESTRINGM(1 0 1, 2 0 2)'::geometry)); st_astext
---------------------
MULTIPOINT(1 0,2 0)
(1 row)Polygon input — returns a LineString representing the exterior ring:
SELECT ST_AsText(ST_Boundary('POLYGON((1 0, 2 0,0 2,1 0))'::geometry)); st_astext
-----------------------------
LINESTRING(1 0,2 0,0 2,1 0)
(1 row)Polygon with holes — returns a MultiLineString containing the exterior and interior rings:
SELECT ST_AsText(ST_Boundary('POLYGON((1 0,3 0,0 3,1 0),(1 0 ,2 0, 0 2 ,1 0))'::geometry)); st_astext
------------------------------------------------------
MULTILINESTRING((1 0,3 0,0 3,1 0),(1 0,2 0,0 2,1 0))
(1 row)See also
该文章对您有帮助吗?