Name

ST_NumInteriorRing — Returns the number of interior rings in a Polygon or a MultiPolygon.

Synopsis

integer ST_NumInteriorRing(bytea Geometry);

Alias

NumInteriorRing, ST_NumInteriorRings, NumInteriorRings

Description

Returns the number of interior rings in a Polygon or a MultiPolygon. If the input geometry is different from a Polygon or MultiPolygon, return null.

Coordinate Dimensions
2D3DM
Spatial Standards Support
OGC SFS for SQL. 1.1 (1999)OGC SFS for SQL. 1.1.0 (2005)OGC SFS for SQL. 1.2.0 (2006))SQL-MM Part 3
2.1.10.17.2.15.17.2.13.28.2.5

Examples

SELECT ST_NRings(geom),ST_NumInteriorRings(geom) FROM (SELECT ST_GeomFromText
('POLYGON ((0 0, 0 10, 10 10, 10 0, 0 0),(2 2, 2 4, 4 4, 4 2, 2 2),(6 6,6 8, 8 8,8 6,6 6))') as geom) as foo;

 st_nrings | st_numinteriorrings
-----------+---------------------
         3 |                   2
(1 row)

Related functions

ST_InteriorRingN