I have three tables in PostGIS, point, poly_a with column "status" and poly_b with column "veg". The point table should get attributes from all polygons it intersects. It works but I noticed that I get duplicates if a point or several points falls inside the overlaps between 2 or several polygons and I can't with my limited SQL get the result that I want to get.
I need for duplicate values to end up on same row but with a separator.
Here is the SQL-code I got now, that I got help from user geozelot to construct.
SELECT
point.*,
poly_a."status",
poly_b."veg"
FROM
point
LEFT JOIN poly_a
ON ST_Intersects(poly_a.geom, point.geom)
LEFT JOIN poly_b
ON ST_Intersects(poly_b, point.geom)
;
I attached an image to make my writing more understandable.
Edit: forgot to mention that it should become a view, and point table has around 4 million points.
