ST_INTERIORRINGN()
All functions > GEOSPATIAL > ST_INTERIORRINGN()
Returns the Nth interior ring (hole) of a Polygon as a LineString (1-indexed).
Signatures
Interior ring N
Returns: The Nth hole as a closed LineString
ST_INTERIORRINGN(polygon: GEOM_POLYGON, n: INT) → GEOM_LINESTRING sql
| Parameter | Type | Required | Description |
|---|---|---|---|
polygon | GEOM_POLYGON | Yes | A Polygon geometry |
n | INT | Yes | 1-based ring index |
Signature notes:
- Index is 1-based
- Out of range index returns NULL
- Input must be a Polygon; other sub kinds return NULL
- GEOMETRY only; not supported on BigQuery
- Returns NULL if any input is NULL
Examples
FeatureQL
SELECT
f1 := ST_ASTEXT(ST_INTERIORRINGN(ST_GEOMFROMTEXT('POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0), (2 2, 4 2, 4 4, 2 4, 2 2))'), 1)) -- First hole of a polygon with one hole
;Result
| f1 VARCHAR |
|---|
| LINESTRING (2 2, 4 2, 4 4, 2 4, 2 2) |
On this page