Oups, typo :
Something like (not tested)
SELECT id
FROM points
EXCEPT
SELECT DISTINCT pt.id
FROM points AS pt
*LEFT JOIN* polygons AS pol ON (ST_Intersects(pt.geom, pol.geom)=TRUE)
2014-08-12 12:47 GMT+02:00 Rémi Cura :
> Hm,
> also,
> if you feel more comfortable,
> instead of trying to find
Hm,
also,
if you feel more comfortable,
instead of trying to find points that are no in any polygons, you can use
the complementary approach.
you can find points that are in at least one polygons, then take all the
points that are not in this set.
The advantage is that it uses the classical query
Hey,
small change if you stick with your original querry (which looks fine).
You may want to force the planner to apply
*points.geom && 'BOX(425930 7197112, 429605.074 7200582.906)'::BOX2D=TRUE;*
before the filtering (to be tested).
If your polygon are well clustered, you could also simply estimate
Hi,
I think it could be simpler and more efficient to use a null select from a left
join and a st_intersects test like this :
SELECT point_id, poly_id, point_geom FROM points_table
LEFT JOIN poly_table ON ST_Intersects(point_geom, poly_geom)
WHERE poly_id IS NULL
NOT EXISTS will also
Hi Lauri,
did you try (untested):
Select a.id,a.geom from points a, polygons b where not
st_intersects/st_contains(a.geom,b.geom);
regards
Simon
Am 12.08.2014 08:52, schrieb Lauri Kajan:
Hi all,
I'm trying to figure out an optimal query to find points in a table
that are not in any polygo