4

I would like to create and atlas that instead of displaying all the features within a layer, it only displayed those related to the atlas.

Certainly, I could do as this excellent answer suggests, which is create a rule-based style for the desired layer and create one rule with an experssion like 'field1' = @atlas_pagename).

Unfortunately, IMHO, this approach has two problems that I would like to overcome:

  1. No features will be displayed in the canvas outside the atlas
  2. It cannot be combined with graduated styles.

In order to solve that, I tried to copy a layer and use a filter with the expression 'field1' = @atlas_pagename and then created a theme that I would use in the layout's map. Therefore, I could use the original layer to edit and visualize from the canvas, and the copied and filtered one for the atlas. Unfortunately, although that makes sense to me, it does not work.

So my question is: is it any way to filter features in QGIS Atlas while being able to see them all in the canvas?

2 Answers 2

5

You can solve your problem using only one layer and using the Geometry generator.

In the symbology of your Coverage Layer select the Geometry generator option: here, in Geometry Type select the option which coincides with the geometry of your coverage layer (point, line or polygons).

Use this expression:

case
--to show the selected geometry in layout
when "Trench_n"  =  @atlas_pagename and @map_id is not  'canvas' then $geometry
--to show all the others on canvas
when "Trench_n"  is not   @atlas_pagename and @map_id is 'canvas'  then $geometry
--to show the selected geometry on canvas
when "Trench_n"  =  @atlas_pagename and @map_id is   'canvas' then $geometry
end

This will permit you to have all the geometries of your layer visible in the Map Canvas, and, at the same time, in the Layout, only the geometry related to the page of the Atlas will be visible.

Result in the image enter image description here

2
  • How did you get that dark theme?
    – GISHuman
    Commented Mar 6, 2020 at 0:46
  • 1
    Go to Settings > Options > General and here in UI Theme select "Night Mapping". Restart to apply the new theme.
    – Val P
    Commented Mar 8, 2020 at 11:37
1

So far, I have had to use the following workaround: to create a layer's duplicate: one will be displayed in the canvas while the other one will be used for the ATLAS

  1. Create a layer with a custom style: this layer will be displayed in the canvas
  2. Create a layer's duplicate and rename it with the sufix ATLAS: this layer will be displayed in the atlas.
  3. Edit the atlas' layer and create a rule-based style, just as explained in this excellent answer
  4. Turn layer #2 off
  5. Save a layer's theme
  6. On the layout's map controlled by atlas, check "Follow theme" option and select theme created in step #5
0

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.