Returns the number of interior rings of a polygon geometry object.
Syntax
integer ST_NumInteriorRings(geometry aPolygon);Parameters
| Parameter | Description |
|---|---|
| aPolygon | The geometry object to query. |
Description
Returns NULL if the input geometry object is not a polygon.
Examples
The following example compares ST_NumInteriorRings with ST_NRings. The polygon has two rings (one exterior, one interior). ST_NRings counts both, while ST_NumInteriorRings counts only the interior ring.
SELECT ST_NRings(geom), ST_NumInteriorRings(geom)
FROM (
SELECT 'POLYGON((1 0,0 3,3 0,1 0),(1 0,2 0,0 2,1 0))'::geometry AS geom
) AS test;Output:
st_nrings | st_numinteriorrings
-----------+---------------------
2 | 1
(1 row)该文章对您有帮助吗?