6

I am looking for a way to define a different style just for the currently used feature of the Coverage layer of Atlas.

The image below will hopefully make it clearer: the left side is how my composition is looking, and on the right is what I would like to achieve. In my case the coverage layer is a map of land plots and I want to have the Page number feature to be styled differently to highlight it as the main object of the map composition.

enter image description here

I have managed to use data overrides to have styles that are applied only in the context of a Print Layout, but they all seem to operate at the layer level and not at a feature level.

Any ideas? Thanks

13

You don't need to consider the page name or number. Since the layer you are trying to dynamically style is the same as the coverage layer, you can use the following expression:

$id = @atlas_featureid

$id is a function that returns the id of each feature of the current layer.

@atlas_featureid is a variable that stores the id of the current atlas feature.

Notice that this variable is only available on map canvas if the atlas preview is enabled.

You can either use the expression on a rule for the rule-based renderer, or directly in a data-defined property of the layer. For example, you could you the following in the outline stroke weight:

CASE WHEN  $id = @atlas_featureid
THEN 4
ELSE 1

Or even better:

CASE WHEN  $id = @atlas_featureid        
THEN @value * 4
ELSE @value

The later will use the @value variable, which returns the outline stroke weight set value and multiple it by 4 for the atlas feature. This allow you to change that setting (e.g. make it thinner) and have the atlas feature keep the proportion of 4 "automagically".

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.