Hi all,

I'm drawing a blank on setting up a query for this.

I have a tables points and a table of polygons. I need to find all the points that are not in any of the polygons.

select a.*
  from points a, polygons b
 where a.the_geom && b.the_geom
   and distance(a.the_geom, b.the_geom) > 0.0;

The problem with this is that if a point is in polygon A it will have a distance to polygon B, so this in no good.

I thought of doing something like:

select * from points
 where distance(the_geom, union((select the_geom from polygons))) > 0.0;

or

select * from points
 where distance(the_geom, collect((select the_geom from polygons))) > 0.0;

So is there a better way to do this. Seems like there should be. If not which of these would you suggest.

Thanks,
  -Steve
_______________________________________________
postgis-users mailing list
[email protected]
http://postgis.refractions.net/mailman/listinfo/postgis-users

Reply via email to