[postgis-users] how to select points outside polygons?
Vishal Mehta
vishal.mehta at sei-us.org
Thu Sep 29 10:21:46 PDT 2011
I have a point layer and a polygon layer. How do I select points that are NOT contained within polygons?
For example, this query correctly selects points contained by polygons
--
select powerplants.gid, plantname
from powerplants, pca_huc
where state = 'CA'
AND
st_contains(pca_huc.geom,powerplants.geom)
order by powerplants.gid;
--
I tried to get the inverse selection using st_disjoint instead of st_contains , but that did not work. I also tried using NOT and EXCEPT without success (although I may not have constructed the latter queries correctly..)
Thanks!
Vishal
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/postgis-users/attachments/20110929/61523d74/attachment.html>
More information about the postgis-users
mailing list