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.
-
1Please 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?– MrXsquaredCommented Oct 14, 2020 at 19:28
Add a comment
|
1 Answer
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:
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)
Both will lead to this label-behavior in print layout:
-
Thank you so much, this is exactly the expression I needed! Commented Oct 15, 2020 at 11:11