TransWikia.com

Styling currently used feature of the Coverage layer of Atlas

Geographic Information Systems Asked by Lisdengard on July 28, 2020

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

One Answer

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 = @atlasfeatureid

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

@atlasfeatureid 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 = @atlasfeatureid
THEN 4
ELSE 1

Or even better:

CASE WHEN  $id = @atlasfeatureid        
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".

Correct answer by Alexandre Neto on July 28, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP