Name

ST_Boundary — Returns the closure of the combinatorial boundary of a Geometry

Synopsis

geometry (bytea Geometry);

Alias

Boundary

Description

Returns the closure of the combinatorial boundary of this Geometry. The elements of a boundary shall be smaller in dimension than the original element, exactly the next lower dimension.

The boundary of a node is the empty set.

The boundary of a line is the empty set if it's closed, otherwise it's the set containing the start and end points.

The boundary of a surface is the set of lines that delineate the edge of the surface, including interior and exterior rings.

[Caution]

If the input geometry is a GEOMETRYCOLLECTION, it throws an error

Coordinate Dimensions
2D3DM
Spatial Standards Support
OGC SFS for SQL. 1.1 (1999)OGC SFS for SQL. 1.1.0 (2005)OGC SFS for SQL. 1.2.0 (2006)SQL-MM Part 3
2.1.1.17.2.10.17.2.8.15.1.14

Examples

--Polygon
SELECT ST_AsText(ST_Boundary(ST_GeomFromText('POLYGON ((20 20, 50 20, 50 50, 20 50, 20 20))')));
--Result
LINESTRING (20 20, 50 20, 50 50, 20 50, 20 20)

--LineString
SELECT ST_AsText(ST_Boundary(ST_GeomFromText('MULTILINESTRING((10 48,10 21,10 0),(16 0,16 23,16 48))')));
--Result
MULTIPOINT (10 0, 10 48, 16 0, 16 48)

--4D LineString
SELECT ST_AsText(ST_Boundary(ST_GeomFromText('LINESTRING(0 0 2 -4,5 0 8 -4,10 0 6 -2)')));
--Result
MULTIPOINT (0 0 2 -4, 10 0 6 -2)

--Multipoint
SELECT ST_AsText(ST_Boundary(ST_GeomFromText('MULTIPOINT (0 0, 1 1, 2 2)')));
--Result
null

Related functions

ST_ExteriorRing