[postgis-users] Finding polygones with 'holes' inside

Obe, Regina robe.dnd at cityofboston.gov
Thu Jul 10 05:25:51 PDT 2008


Stephan,

Well since you have a multipolygon, I think you have to do something
like this

SELECT gid, name
FROM (SELECT gid, name, (ST_Dump(the_geom)).geom As the_geom
FROM table ) As thetable
WHERE ST_NumInteriorRings(the_geom) > 0; 

I would have suggested just running ST_NumInteriorRings instead of the
subselect, but I think ST_NumInteriorRings only looks at the first
polygon in the MULTI set so you have to deconstitute it with ST_Dump
into individual polygons.

Your ST_nrings > 1 would also then work too.

Hope that helps,
Regina

-----Original Message-----
From: postgis-users-bounces at postgis.refractions.net
[mailto:postgis-users-bounces at postgis.refractions.net] On Behalf Of
Stephan Holl
Sent: Thursday, July 10, 2008 8:06 AM
To: postgis-users at postgis.refractions.net
Subject: [postgis-users] Finding polygones with 'holes' inside

Hi,

I like to accomplish the task of finding polygons with holes inside
(the table is a MULTIPOLYGON). 
I tried to use ST_nrings, but I am not sure it this always only finds
polygons with wholes inside or also islands, which should be also rings
by definition.

So a 

SELECT gid, name FROM table WHERE ST_nrings(the_geom) > 1;

does not only
find whole polygons, but also polygons with more than one polygon.

PostGIS 1.3.3 with PG 8.3.3

Is there an option to identify 'holes' within polygons directly?

Thanks

	Stephan
_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users
-----------------------------------------
The substance of this message, including any attachments, may be
confidential, legally privileged and/or exempt from disclosure
pursuant to Massachusetts law. It is intended
solely for the addressee. If you received this in error, please
contact the sender and delete the material from any computer.




More information about the postgis-users mailing list