名稱

ST_NumInteriorRings — 傳回多邊形 (Polygon) 的內部環(孔洞)數量。

概要

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;