This topic describes the ST_InteriorRingN function. This function returns the Nth interior ring of the input polygon object as a LineString object. The interior rings are identified by the specified indexes. The indexes start from 1.
Syntax
geometry ST_InteriorRingN(geometry aPolygon , integer n);
Parameters
Parameter | Description |
---|---|
aPolygon | The polygon object that you want to specify. |
n | The index number of the interior ring that you want to obtain. |
Description
- If the input geometry object is not a polygon object or the value of the n parameter is invalid, this function returns NULL.
- This function does not support MultiPolygon objects. You need to use the ST_Dump function to convert a MultiPolygon object into a polygon object.
- This function supports 3D objects and does not delete z coordinates.
Examples
SELECT ST_AsText(ST_InteriorRingN('POLYGON((1 0,3 0,0 3,1 0),(1 0,2 0, 0 2,1 0))'::geometry, 1));
st_astext
-----------------------------
LINESTRING(1 0,2 0,0 2,1 0)
(1 row)