[postgis-users] Using ST_NumInteriorRings() on MULTIPOLYGON

Lee Hachadoorian Lee.Hachadoorian+L at gmail.com
Sun Nov 3 13:38:37 PST 2013


According to the docs, ST_NumInteriorRings() is supposed to work on
MULTIPOLYGONs:

"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]

But when I try it I am getting NULL. Using on a POLYGON returns expected
result.

Compare the results of these two queries.

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;
 nrings | ninterrings
--------+-------------
      2 |           1
(1 row)

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;
 nrings | ninterrings
--------+-------------
      2 |
(1 row)

PostGIS 2.0
GEOS 3.3.8-CAPI-1.7.8
PROJ Rel. 4.8.0, 6 March 2012
Tested on Linux Mint 13 & 15

Best,
--Lee


-- 
Lee Hachadoorian
Asst Professor of Geography, Dartmouth College
http://freecity.commons.gc.cuny.edu/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20131103/617de02d/attachment.html>


More information about the postgis-users mailing list