2

I have two polygon layers. Layer 1 is the coverage layer for an atlas. I would like the color of labels for layer 2 to change based on whether or not the feature overlaps with the current atlas controlling feature in layer 1. Here is what I've tried as the expression controlling label color in layer 2:

case when intersects_bbox($geometry, atlas_geometry)
then color_rgb(0,0,0) else color_rgb(255,255,255) end

But all the labels are black no matter what I try. What am I doing wrong? (and is there a better way to do this?

1 Answer 1

1

atlas_geometry should be $atlas_geometry (or @atlas_geometry for QGIS >= 2.12 ).

So your expression should be

case when intersects_bbox($geometry, $atlas_geometry)
then color_rgb(0,0,0) else color_rgb(255,255,255) end
1
  • Thanks! only worked with @atlas_geometry though, not $atlas_geometry. Came up with an error: no root node
    – user52245
    Jan 11, 2016 at 5:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.