I have a point layer with one field, id
ranging from 0 to 9. I have a polygon that intersects some of the points, like so:
My aim is to use an expression to get the intersecting point with the highest value for id
.
For demonstration purposes I use a Geometry Generator symbol layer on my polygon layer.
collect_geometries(
overlay_intersects(
'point_layer',
$geometry,
filter:= id = array_max(overlay_intersects('point_layer', id))
)
)
I expect there to be a single point at the location of the point in point_layer
with the highest id
(9). However, all intersecting points are returned.
When I test the expression I use for the filter as a standalone expression, it returns 9, as expected.
And when I hard-code the highest id
value (9), I get the desired result:
collect_geometries(
overlay_intersects(
'point_layer',
$geometry,
filter:= id = 9
)
)
What am I missing?