Felix Kunde <felix-kunde@gmx.de> wrote:
ich hoffe, ich habs richtig verstanden: Also sobald auch nur ein Punktfeature mit einer bestimmten Eigenschaft innerhalb des Polygons liegt, soll der Wert true sein?
Genau.
Dann hätte ich folgende Abfrage mit Dummylisten zum schnellen ausprobieren:
SELECT poly.id AS pid, bool_or(COALESCE(_ST_Intersects(poly.geom, pt.geom) AND pt.feat = 'foo', FALSE)) AS f1_test, bool_or(COALESCE(_ST_Intersects(poly.geom, pt.geom) AND pt.feat = 'bar', FALSE)) AS f2_test FROM (VALUES (1, 'POLYGON((0 0,2 0,2 2,0 2,0 0))'::geometry), (2, 'POLYGON((2 2,4 2,4 4,2 4,2 2))'::geometry)) AS poly(id, geom) LEFT JOIN (VALUES (1, 'foo', 'POINT(1 1)'::geometry), (2, 'bar', 'POINT(2 2)'::geometry)) AS pt(id, feat, geom) ON poly.geom && pt.geom GROUP BY poly.id;
Danke. Das sieht doch schon mal super aus. Um das mit realen Daten auszuprobieren muss ich die Query auf eine BBox begrenzen. Normalerweise habe ich da sowas im query: SELECT ... WHERE ... and geom && SetSRID('BOX3D(x1 y1, x2 y2)'::box3d,4326) Wo müsste das hin? Hinter "&& pt.geom"? Und eine zweite Frage noch, was bedeutet der Unterstrich vor ST_Intersects? Sven -- "If you don't make lower-resolution mapping data publicly available, there will be people with their cars and GPS devices, driving around with their laptops" (Tim Berners-Lee) /me is giggls@ircnet, http://sven.gegg.us/ on the Web