[postgis-users] Selecting polygons circled by one only polygons

pcreso at pcreso.com pcreso at pcreso.com
Thu Oct 28 10:09:08 PDT 2010


Hi,

If I understand the question correctly, you want to identify polygons which are outside of a polygon (including inside the hole of another polygon) but within the outer polygon perimeter.

You can do this with a self relation (join a table to itself). Something like:

select t1.name from table t1, table t2
where not ST-Within (t1.geom, t2.geom)
    and ST_Within(t1.geom, ST_Boundary(t2.geom));

To get the count of these, rather than the list of names, try:

select count(t1.name) from table t1, table t2

where not ST-Within (t1.geom, t2.geom)

    and ST_Within(t1.geom, ST_Boundary(t2.geom));

HTH,

 Brent Wood


Sent: Thursday, October 28, 2010 6:07 
  AM
To: PostGIS Users Discussion
Subject: [postgis-users] 
  Selecting polygons circled by one only 
  polygons

Hi,

I have a table of polygon where every 
  polygon can be holed.
And in the hole can be inside another polygon 
  (another record of the table, no multipolygons).

I need to detect all 
  the polygon that are inside a hole of another polygon.

Initially I 
  think this was easy but
after some test I notice this is not so easy 
  because the polygon inside the hole is formerly disjoint from the polygon with 
  hole.

For more example I don't search the polygon that are full circled 
  by more than 1 polygon, but only the polygon circled by 1 only 
  polygon

There is some method to detect this type of situations 
  ?


Thx,

Andrea peri.

-- 
  
-----------------
Andrea Peri
. . . . . . . . . 
qwerty 
  àèìòù
-----------------


-----Inline Attachment Follows-----

_______________________________________________
postgis-users mailing list
postgis-users at postgis.refractions.net
http://postgis.refractions.net/mailman/listinfo/postgis-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20101028/d853d972/attachment.html>


More information about the postgis-users mailing list