[GIS] QGIS Atlas turning on/off raster layers

atlasqgisraster

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.

Best Answer

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.

Related Question