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

Stephan Holl stephan.holl at intevation.de
Thu Jul 17 04:14:07 PDT 2008


Hello Regina,

"Obe, Regina" <robe.dnd at cityofboston.gov>, [20080710 - 08:25:51]

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

Thanks for your detailed explaination.
It is perfectly working.

Best

	Stephan


> 
> -----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.
> 
> _______________________________________________
> postgis-users mailing list
> postgis-users at postgis.refractions.net
> http://postgis.refractions.net/mailman/listinfo/postgis-users


-- 
Stephan Holl <stephan.holl at intevation.de>, http://intevation.de/~stephan
Tel: +49 (0)541-33 50 8 32 | Intevation GmbH | AG Osnabrück - HR B 18998
Geschäftsführer:  Frank Koormann, Bernhard Reiter, Dr. Jan-Oliver Wagner



More information about the postgis-users mailing list