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?


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
  • Thanks! only worked with @atlas_geometry though, not $atlas_geometry. Came up with an error: no root node – Jesse McMillan Jan 11 '16 at 5:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.