<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;"><b></b><br>Hi,<br><br>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.<br><br>You can do this with a self relation (join a table to itself). Something like:<br><br>select t1.name from table t1, table t2<br>where not ST-Within (t1.geom, t2.geom)<br>    and ST_Within(t1.geom, ST_Boundary(t2.geom));<br><br>To get the count of these, rather than the list of names, try:<br><br>select count(t1.name) from table t1, table t2<br>
where not ST-Within (t1.geom, t2.geom)<br>
    and ST_Within(t1.geom, ST_Boundary(t2.geom));<br><br>HTH,<br><br> Brent Wood<br><br><br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><div id="yiv2127168725"><blockquote><div dir="ltr" class="yiv2127168725OutlookMessageHeader" align="left"><font size="2" face="Tahoma"><b>Sent:</b> Thursday, October 28, 2010 6:07 
  AM<br><b>To:</b> PostGIS Users Discussion<br><b>Subject:</b> [postgis-users] 
  Selecting polygons circled by one only 
  polygons<br><br></font></div>Hi,<br><br>I have a table of polygon where every 
  polygon can be holed.<br>And in the hole can be inside another polygon 
  (another record of the table, no multipolygons).<br><br>I need to detect all 
  the polygon that are inside a hole of another polygon.<br><br>Initially I 
  think this was easy but<br>after some test I notice this is not so easy 
  because the polygon inside the hole is formerly disjoint from the polygon with 
  hole.<br><br>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<br><br>There is some method to detect this type of situations 
  ?<br><br><br>Thx,<br><br>Andrea peri.<br><br>-- 
  <br>-----------------<br>Andrea Peri<br>. . . . . . . . . <br>qwerty 
  אטלעש<br>-----------------<br><br></blockquote></div><br>-----Inline Attachment Follows-----<br><br><div class="plainMail">_______________________________________________<br>postgis-users mailing list<br><a ymailto="mailto:postgis-users@postgis.refractions.net" href="/mc/compose?to=postgis-users@postgis.refractions.net">postgis-users@postgis.refractions.net</a><br><a href="http://postgis.refractions.net/mailman/listinfo/postgis-users" target="_blank">http://postgis.refractions.net/mailman/listinfo/postgis-users</a><br></div></blockquote></td></tr></table>