<div dir="ltr"><div dir="ltr"><span style="font-family:arial,sans-serif;font-size:13px">According to the docs, ST_NumInteriorRings() is supposed to work on MULTIPOLYGONs:</span><div style="font-family:arial,sans-serif;font-size:13px">
<br></div><div style="font-family:arial,sans-serif;font-size:13px">"This will work with both POLYGON and MULTIPOLYGON types but only looks at the first polygon. Return NULL if there is no polygon in the geometry." [1]<br>
</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">But when I try it I am getting NULL. Using on a POLYGON returns expected result.</div><div style="font-family:arial,sans-serif;font-size:13px">
<br></div><div style="font-family:arial,sans-serif;font-size:13px">Compare the results of these two queries.</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">
<div>universe=# SELECT ST_NRings(the_geom) As Nrings, ST_NumInteriorRings(the_geom) As ninterrings FROM (SELECT ST_GeomFromText('POLYGON((-10 -10, 10 -10, 10 10, -10 10, -10 -10),(-5 -5, 5 -5, 5 5, -5 5, -5 -5))') As the_geom) As foo;</div>
<div> nrings | ninterrings </div><div>--------+-------------</div><div>      2 |           1</div><div>(1 row)</div><div><br></div><div>universe=# SELECT ST_NRings(the_geom) As Nrings, ST_NumInteriorRings(the_geom) As ninterrings FROM (SELECT ST_GeomFromText('MULTIPOLYGON(((-10 -10, 10 -10, 10 10, -10 10, -10 -10),(-5 -5, 5 -5, 5 5, -5 5, -5 -5)))') As the_geom) As foo;</div>
<div> nrings | ninterrings </div><div>--------+-------------</div><div>      2 |            </div><div>(1 row)</div></div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">
PostGIS 2.0</div><div style="font-family:arial,sans-serif;font-size:13px">GEOS 3.3.8-CAPI-1.7.8</div><div style="font-family:arial,sans-serif;font-size:13px">PROJ Rel. 4.8.0, 6 March 2012</div><div style="font-family:arial,sans-serif;font-size:13px">
Tested on Linux Mint 13 & 15</div><div style="font-family:arial,sans-serif;font-size:13px"><br></div><div style="font-family:arial,sans-serif;font-size:13px">Best,</div><div style="font-family:arial,sans-serif;font-size:13px">
--Lee</div></div><br clear="all"><div><br></div>-- <br>Lee Hachadoorian<br>Asst Professor of Geography, Dartmouth College<br><a href="http://freecity.commons.gc.cuny.edu/" target="_blank">http://freecity.commons.gc.cuny.edu/</a>
</div>