Have you tried SELECT a.gid, a.the_geom FROM a INNER JOIN b ON (b.gid = 100 AND ST_DWithin(a.the_geom, b.the_geom,1) ) WHERE NOT ST_Within(a.the_geom, b.the_geom) Hope that helps, Regina
_____ From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Brian Sanjeewa Rupasinghe Sent: Thursday, August 14, 2008 5:53 AM To: [email protected] Subject: [postgis-users] Spatial Query Hi, I have polygon features in PostgreSQL database. How can i make a query to find all polygons that are within a distance of say 1m from polygon id = 100. Query should not select polygons that are within polygon id = 100. I used ST_WIthindistance, but it selcted all insidepolygons too. Please help me if you have any sample code or clue. Thanks in advance, Sanjeewa.
_______________________________________________ postgis-users mailing list [email protected] http://postgis.refractions.net/mailman/listinfo/postgis-users
