In QGIS Atlas, I can use $id = @atlas_featureid and $id <> @atlas_featureid to highlight the label names of my main region (Fig.1: more clear name in the AOI than the outside ones). How can we do similar highlight to the label names other layers or sub-regions, have to link with Atlas setting? E.g. in Fig.2, I want the label names (in English) outside the AOI are transparent than the inside ones.

enter image description here

enter image description here


1 Answer 1


Imagining your subregion table has a column with the same region code mentioned in it attributes as in one column of the subregion layer, you can add a label rule within "Rule-based Labeling" with the following condition


where 'COL_NAME_REGION_CODE_FROM_COVERAGE' is the column name in your coverage layer feature and code region column in your current subregion layer is "COL_NAME_REGION_CODE_IN_YOUR_LAYER"

You could use also compare geometry from atlas selected feature with the geometry of your subregion layer using something like:

within(point_on_surface($geometry), @atlas_geometry)

It would be quite inefficient to check spatial relationships on the fly each time. It can be a possible solution if no matching column code between your tables, but I prefer adding a column in the subregion layer and fill it once using the same spatial relationship logic instead of calculating it on the fly each time.

  • Thank you Thomas for your quick help. In my Region and Subregion layers have one same column named ADM1_PCODE with the same code, so if I'm not wrong, the statement could be: attribute( @atlas_feature , 'ADM1_PCODE') = "ADM1_PCODE". But it doesn't show any names of Subregion yet.
    – GISarath
    Jun 27, 2021 at 0:43
  • within(point_on_surface($geometry), @atlas_geometry) doesn't show the label names on the map also.
    – GISarath
    Jun 27, 2021 at 0:51
  • Did you activate the atlas? Both works on my own sample.
    – ThomasG77
    Jun 27, 2021 at 0:56
  • Where did you set the expression? In your subregion layer labels panel properties?
    – ThomasG77
    Jun 27, 2021 at 1:04
  • It works now. Sorry, it's my mistake to not select the field name in Value field. Thank you very much.
    – GISarath
    Jun 27, 2021 at 1:37

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.