Categories
Software Stuff

(Ab)Using themes in QGIS to make an atlas

Recently I needed to generate a number of maps of the same place, but with different raster data for map. Given that I had way too many for me to want to manually manage each raster layer, I asked for a different approach on the Spatial Community Slack, and this is what was suggested:

The layout manager, showing the data-defined option.
  • Create a number of themes, with whichever raster layer is needed as the main thing visible.
  • Create a new polygon layer. This needs to have an attribute column which will take theme names, and each polygon will then get a theme name in that column. Create a new polygon for each raster that needs to be themed.
  • In the print composer, you can then use the data-defined options to make the map theme follow the variable in the column for the polygon previously created. (See image.)
  • This will then let each page generated in the atlas use the same extent while changing the layer being shown.

Hopefully this very terse description is enough to let people follow along. If not, please do get in touch. (The Slack community mentioned above is good, otherwise mtb@martinb.za.net will reach me.)

Thanks to Nathan Woodrow in the QGIS channel at the Spatial Community for pointing me in this direction, and letting me put up a blogpost describing this.