1

I want show different imagery backgrounds in a QGIS atlas based on which one is better.

I have the following highlighted imagery layers

enter image description here

In the dataset used for the atlas I have

enter image description here

How do I set up the lock layers expression in the Map Properties to just turn on the background imagery that's listed in the background column? The expected input is list of map layer names separated by | characters but I would prefer to define just the layers to add (so that all the vector data that's in the map view are also retained and just the listed background is added).

enter image description here

2 Answers 2

4

If you would like to avoid having to change a text list for visible layers, why not set up separate map themes with different layer visibility settings and descriptive names (e.g. Bing, Google, ESRI, SISP) You just make visible the layers you want and add that as a theme from the Layers panel.

THen set up a data-defined override for map themes on your map item in layout. You can refer to a specific column in your data that has the name of the most suitable map theme (=raster source) for each layer, or use some other custom logic, like

CASE 
WHEN "Zoom" > 4000 THEN 'HighResMapThemeName'
WHEN "Zoom" =< 4000 AND "Zoom" > 2000 THEN 'MedResMapThemeName'
WHEN "Zoom" =< 2000 THEN 'LowResMapThemeName'
ELSE 'DefaultMapThemeName'
END

And if you want to tweak the map theme (e.g. use a different ESRI layer, show or remove another polygon layer) you can easily modify that in teh main canvas without having to change anything in the map layout.

4

If I understand your question correctly, it should be fairly straight forward.

Assuming you have 3 vector layers that you want to show on all your atlas maps. Lets call them VectorLayer1 (on top of everything), VectorLayer2 (middle) and VectorLayer3 (bottom layer). These layers should be named as such in your layers panel.

I think you want to uncheck the lock layers and in the expression put this instead:

'VectorLayer1|VectorLayer2|VectorLayer3|'||Background

QGIS is reading those three vector layers in top to bottom order as strings and then throwing the Background variable at the end. You can add as many layers (vector or otherwise) as you like. Let me know if it works out for you.

1
  • Thanks - I was trying to do this without having to nominate each layer to include. So all layers that are On should be shown and also the one specified that would be Off. Otherwise if I add/remove layers I have to go back and change the list.
    – GeorgeC
    May 26, 2020 at 2:44

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.