Name

ST_NumInteriorRings — Returns the number of interior rings (holes) of a Polygon.

Synopsis

integer ST_NumInteriorRings(geometry a_polygon);

Descrizione

Return the number of interior rings of a polygon geometry. Return NULL if the geometry is not a polygon.

Questo metodo implementa la specifica SQL/MM. SQL-MM 3: 8.2.5

Changed: 2.0.0 - in prior versions it would allow passing a MULTIPOLYGON, returning the number of interior rings of first POLYGON.

Esempi

--If you have a regular polygon
SELECT gid, field1, field2, ST_NumInteriorRings(geom) AS numholes
FROM sometable;

--If you have multipolygons
--And you want to know the total number of interior rings in the MULTIPOLYGON
SELECT gid, field1, field2, SUM(ST_NumInteriorRings(geom)) AS numholes
FROM (SELECT gid, field1, field2, (ST_Dump(geom)).geom As geom
        FROM sometable) As foo
GROUP BY gid, field1,field2;
                        

Si veda anche

ST_NumInteriorRing, ST_PointN