Name

ST_NumInteriorRings — 返回多边形的内环(孔)数。

Synopsis

integer ST_NumInteriorRings(geometry a_polygon);

描述

返回多边形几何体的内环数。 如果几何图形不是多边形,则返回 NULL。

该方法实现了SQL/MM规范。 SQL-MM 3: 8.2.5

更改:2.0.0 - 在之前的版本中,它允许传递 MULTIPOLYGON,返回第一个 POLYGON 的内环数量。

示例

--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;