I'm attempting to create a series of maps in QGIS atlas with the same coverage and background data but different raster outputs (flood mapping outputs for a range of scenarios).

I've created a shapefile coverage layer containing polygons for each of the scenarios and using the polygon identifier attempted to turn on and off raster layers using a function within a label object. I've played around with the function for a while but can't get it to work...

Does this sound like the right approach that I'm taking? Is there a better way to do this?

I'm very much a beginner when it comes to using functions in QGIS.

2 Answers 2


I've just done this with 84 different raster layers. The method i used was:

  1. Create an atlas polygons layer with 84 features in it.
  2. Create a text field in the atlas polygons layer and write the names of all of the layers you want that atlas map to show, separated by the | character. For examle: If you wanted to show three fields: "flood_results","Background_mapping" and "Vector_layer" then your field would contain this string: flood_results|Background_mapping|Vector_layer My Layers field
  3. Assign your atlas polygons in the Atlas Generation tab

  4. In the print composer, the item properties for the map view window: there is a lock layers for map item checkbox with a data-defined override field option, make this field your text field with the layers in. Data override field

Now as you cycle through your atlas maps, the layers will change depending on the layers specified in the layers field of each atlas polygon.

  • 2
    I just used this method succsessfully. Note that the order the layers are listed in the layers field overrides their position in the layers panel, with layers drawn in reverse order as listed. In the example given in step 4, "flood_results" will be on top of "Background_mapping" which is on top of "vector_layer" . Thanks Commented Mar 31, 2017 at 19:54

I just had the same problem.

What I hadn't realised is that the composer always shows you the raster layer that is turned on in QGIS. (In the composer, refresh by pressing F5). This means that you can have QGIS on one Screen, the composer on the other screen (providing you are so lucky to have two screens) and just turn your flood map rasters on and off.

That way you need only three clicks for each Flood Scenario.

  1. Turn correct scenario on in QGIS
  2. Switch to your composer and press F5 (optional)
  3. Change Text to reflect Scenario
  4. Output as PDF
  • Thanks Hermann. Problem is I have 50+ Maps that I need to generate. It's likely that we'll also be making revisions to the maps so I will need to go through the process again and again. I need an automated process (as per my original question) but I just cant get it to work.
    – Sean Cowan
    Commented Sep 7, 2016 at 8:03

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.