ST_NUMINTERIORRINGS()
All functions > GEOSPATIAL > ST_NUMINTERIORRINGS()
Returns the number of interior rings (holes) in a Polygon.
Signatures
Number of interior rings
Returns: Number of holes
ST_NUMINTERIORRINGS(polygon: GEOM_POLYGON) → BIGINT sql
| Parameter | Type | Required | Description |
|---|---|---|---|
polygon | GEOM_POLYGON | Yes | A Polygon geometry |
Signature notes:
- Returns 0 for a polygon with no holes
- Input must be a Polygon; other sub kinds return NULL
- GEOMETRY only; not supported on BigQuery
- On Trino: transpiled to ST_NumInteriorRing (no trailing 's')
- Returns NULL if the input is NULL
Examples
FeatureQL
SELECT
f1 := ST_NUMINTERIORRINGS(ST_GEOMFROMTEXT('POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0), (2 2, 4 2, 4 4, 2 4, 2 2))')), -- Polygon with one hole
f2 := ST_NUMINTERIORRINGS(ST_GEOMFROMTEXT('POLYGON ((0 0, 10 0, 10 10, 0 10, 0 0))')) -- Polygon without holes
;Result
| f1 BIGINT | f2 BIGINT |
|---|---|
| 1 | 0 |
On this page