Skip to content

ST_Boundary

Returns the closure of the combinatorial boundary of this geometry or geography.

Usage

geometry ST_Boundary(geom: geometry)
geography ST_Boundary(geog: geography)

Arguments

  • geog (geography): Input geography
  • geom (geometry): Input geometry

Description

For a polygon, the boundary is the exterior and interior rings; for a linestring it is the endpoints.

Examples

SELECT ST_Boundary(ST_GeomFromWKT('POLYGON((1 1, 0 0, -1 1, 1 1))'));
┌─────────────────────────────────────────────────────────────────────┐
│ st_boundary(st_geomfromwkt(Utf8("POLYGON((1 1, 0 0, -1 1, 1 1))"))) │
│                               geometry                              │
╞═════════════════════════════════════════════════════════════════════╡
│ LINESTRING(1 1,0 0,-1 1,1 1)                                        │
└─────────────────────────────────────────────────────────────────────┘
SELECT ST_Boundary(ST_GeogFromWKT('POLYGON((1 1, 0 0, -1 1, 1 1))'));
┌─────────────────────────────────────────────────────────────────────┐
│ st_boundary(st_geogfromwkt(Utf8("POLYGON((1 1, 0 0, -1 1, 1 1))"))) │
│                              geography                              │
╞═════════════════════════════════════════════════════════════════════╡
│ LINESTRING(1 1,0 0,-1 1,1 1)                                        │
└─────────────────────────────────────────────────────────────────────┘