2

I want to create an atlas which is based on region polygons. I use inverted polygons and rule based styles (inverted polygons) for the polygon layer with the rule $id = @atlas_featureid which works fine. I have also a point layer and the features of the point layer are not shown due to the inverted polygons but their labels are shown. I want to prevent the labels outside of the current atlas feature polygon. Which expression should I use for the rule-based-labeling? I found this post (Filtering out labels surrounding active feature in Atlas) and tried the suggested rule-based filtering expressions but it didn't work for me.

enter image description here

1
  • 1
    Please elaborate "tried the suggested rule-based filtering expressions but it didn't work" a little more. Which of the solutions and how did you set it up?
    – MrXsquared
    Commented Oct 14, 2020 at 19:28

1 Answer 1

6

Via data defined override:

Go to "Labels" --> "Rendering" --> "Show label" --> "Data defined override" of your point-layer and insert intersects($geometry,@atlas_geometry) as expression as shown below:

enter image description here

Or via Rule Based Labeling:

Go to "Labels" --> "Rule-Based Labeling" of your point-layer and set up one rule with an expression like this: intersects($geometry,@atlas_geometry)

enter image description here

Both will lead to this label-behavior in print layout:

enter image description here

1
  • Thank you so much, this is exactly the expression I needed! Commented Oct 15, 2020 at 11:11

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.