Returns a LineString representing the exterior ring of a polygon.
Syntax
geometry ST_ExteriorRing(geometry aPolygon);Parameters
| Parameter | Description |
|---|---|
aPolygon | The input polygon geometry. |
Usage notes
Returns NULL if
aPolygonis not a polygon geometry.Supports 3D geometries and preserves Z coordinates.
Examples
Extract the exterior ring of a polygon
SELECT ST_AsText(ST_ExteriorRing('POLYGON((1 0,3 0,0 3,1 0),(1 0,2 0, 0 2,1 0))'::geometry));Output:
st_astext
-----------------------------
LINESTRING(1 0,3 0,0 3,1 0)
(1 row)Extract exterior rings from a table of polygons
SELECT gid, ST_ExteriorRing(geom) AS exterior_ring
FROM parcels;Related topics
ST_InteriorRingN: Returns the Nth interior ring of a polygon.
ST_NumInteriorRings: Returns the number of interior rings in a polygon.
ST_Boundary: Returns the closure of the combinatorial boundary of a geometry.
该文章对您有帮助吗?