ST_InteriorRingN¶
Introduction: Returns the Nth (1-based) interior linestring ring of the polygon geometry. Returns NULL if the geometry is not a polygon or the given N is out of range
Note
Since v2.0.0, n is 1-based, as in PostGIS: n = 1 returns the first interior ring, and 0 or a negative n returns null. Earlier versions read n 0-based.
Format: ST_InteriorRingN(geom: geometry, n: Int)
Return type: Geometry
SQL example:
SELECT ST_InteriorRingN(ST_GeomFromText('POLYGON((0 0, 0 5, 5 5, 5 0, 0 0), (1 1, 2 1, 2 2, 1 2, 1 1), (1 3, 2 3, 2 4, 1 4, 1 3), (3 3, 4 3, 4 4, 3 4, 3 3))'), 1)
Output: LINESTRING (1 1, 2 1, 2 2, 1 2, 1 1)