1

A project with 2 shapefiles

  • shapefile road (multiline)
  • shapefile crossings of roads (point)

I have 2 atlas reports, one about the road and the other about crossings Both should highlight the selected item : the road on the first and the crossing on the second. I use rules in the symbology of both shapefiles with "@atlas_featureid = $id" for a highlighted color.

When I run the crossing report, where I want to have the crossing selected highlighted, a road is also highlighted !!! It seems that this is the road with the same id of the crossing selected!! Should I use another rule expression in such a way only the crossing selected is highlighted (something like "@atlas_featureid = $id of crossing shapefile")

1 Answer 1

2

It makes sense, because those IDs are really just numbers and your expression compares them regardless of the relationship between layer and atlas.

You could fix your issue by using different map themes or layer styles in the two atlases, or by extending the expressions to also check the $atlas_layerid.

3
  • Thanks, I will have a look and see how to use it
    – ClaudeVer
    Commented Mar 10, 2023 at 12:26
  • I had a look, but did not find any info on the variable atlas_layerid. When i try to use it in the expression editor, it is not recognised! Anyway, this comments help me to go further and replace the classic @atlas_featureid = $id by a more specific expression attributes(@atlas_feature) ['Nom'] = "Nom" and this seems to work
    – ClaudeVer
    Commented Mar 11, 2023 at 9:44
  • Hm, weird. There is such a variable but it seems only available in the layout designer, not for styling of layers. Commented Mar 11, 2023 at 10:34

Your Answer

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

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