This topic describes the ST_Boundary function. This function returns the boundary of the input geometry object.
Syntax
geometry ST_Boundary(geometry geomA);
Parameters
Parameter | Description |
---|---|
geomA | The geometry object that you want to specify. |
Description
This function supports 3D objects and does not delete z coordinates.
Examples
- If you specify a point object, the function returns an empty GeometryCollection object.
SELECT ST_AsText(ST_Boundary('POINT(1 0)'::geometry)); st_astext -------------------------- GEOMETRYCOLLECTION EMPTY (1 row)
- If you specify a LineString object, the function returns a MultiPoint object.
SELECT ST_AsText(ST_Boundary('LINESTRINGM(1 0 1, 2 0 2)'::geometry)); st_astext --------------------- MULTIPOINT(1 0,2 0) (1 row)
- If you specify a polygon object, the function returns a LineString object.
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)
- If you specify a polygon object containing holes, the function returns a MultiLineString
object.
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)