You can use data driven override for the color and set an expression that evaluates the condition: if the condition is met, color is red, otherwise green.
If the points are exactly in the same place and you want to have the points in red if at least one of the overlapping points has value true
for the attribute named x
, use this expression:
if (
array_contains( overlay_equals(@layer, x), true),
'red',
'green'
)
Several points on the same spot - if all points have value false
, they are green, otherwise red:
Variants
Adapt the expressions to your needs. If the points are nearby, but not exactly in the same place, use overlay_nearest
, e.g. like this to color each "cluster" of points according to a condition if it contains at least one true
value or not:
if (
array_contains(
array_append(
overlay_nearest(@layer, x, max_distance:=100, limit:=100),
x
),
true
),
'red',
'green'
)
If the current point or any other points within 100 meters is true
, color is red, otherwise green: