Atlases in Context

“An atlas in QGIS is a series of maps designed to provide a cohesive map series on a topic or region”

If you need to create a series of maps it is very boring and error-prone to do it manually. Fortunately, QGIS provides a mechanism to generate a map series easily. A coverage layer is used to manage the atlas generation process. One page is generated per coverage feature. You can compile all the maps into a single PDF document or a series of PDF's or images.

You try:

Goal: To produce a map series showing water resources in the context of agricultural lands.

  • Use the data provided with this tutorial to add agricultural fields, lakes, streams and the grid to your map.
  • Note that the map should be in a projected CRS. In this case, you'll notice the canvas is already in UTM for Denmark.
  • Create a legend preset with just the grid visible - call the preset 'Grid'
  • Create a map composer layout
  • Enable atlas in the atlas tab
  • Set atlas coverage layer to 'Grid'
  • Enable 'single file export when possible'
  • Add a map ('map0') approx 180mm x 180mm
  • Set the map scale to 7500
  • Enable 'controlled by atlas'
  • Set to use 'fixed scale'
  • Create two grids as per table, right (grid1, grid2)
  • Add a table
  • Link the table to the agricultural_fields layer
  • Enable table feature filtering: Show only features intersecting with atlas feature
  • Modify table attributes to show only first 3 attributes
  • Add an overview map ('map1'), linked to map0

Name Expectation

Grid layer symbol renderer

Inverted Polygon

Grid layer sub renderer

Rule based

Grid layer rule name

Mask

Grid layer rule

$id = @atlas_featureid

Grid layer symbol renderer

Simple fill, white, 50% transparent

Page label

Page [% @atlas_featurenumber %] of [% @atlas_totalfeatures %]

Operator label

Operator: [% @user_full_name %]

Production date label

Production date: [%format_date( now(), 'd/M/yyyy')%]

Map0: grid1

Rename grid1 to UTM Set CRS to UTM Grid spacing x & y: 500m Labels on left, top Left labels vertical ascending Label text and lines in blue

Map0: grid2

Rename grid2 to LatLong Set CRS to EPSG:4326 Grid spacing x & y: 0.008 degrees Labels on right, bottom Right labels vertical ascending Label text and lines in red

More about

The process of building an atlas in QGIS is fairly simple: Prepare a project in QGIS. Then create a map composition. In the map composer, enable map composer and indicate which layer will be the coverage layer. A coverage layer is a polygon layer that contains areas to be included in the atlas. When generating the atlas, QGIS will sequentially zoom to each feature in the coverage layer and render a map page for that feature.

QGIS provides a number of special variables for you to use when creating your atlas:
@atlas_feature - The current feature from the coverage map. You can use this to access any attributes from the current atlas feature record.
@atlas_featureid - The ID of the current feature in the coverage map.
@atlas_featurenumber - The sequential feature number of the current coverage feature.
@atlas_filename - the name of the file that will be created when rendering the current atlas page
@atlas_geometry - the geometry of the current coverage feature in your atlas.
@atlas_pagename - the generated name (if any) for the current page.
@atlas_totalfeatures - total number of coverage features for the atlas

You can combine these elements in labels on your map so that each page has textual elements specific to that coverage area. Another thing you can do with the atlas variables is by masking away the surrounding coverage areas so that only the current area is highlighted.
In the map composer, you can enable preview mode (icon in the red box above). Pressing the forward and backwards arrows will update the composer layout preview to the next or previous coverage feature.

Note: When you want to print or export your atlas, you must use the print/export button on the atlas toolbar, not on the main map composer toolbar.

Check your knowledge:

  1. An atlas is:
    1. A very well built man who holds a globe over his head
    2. A series of maps generated in sequence
    3. A way to create an animated slide show based on a QGIS map
  2. What will happen if you delete one of the grid polygons from your coverage layer:
    1. QGIS will give an error message
    2. The atlas will not mask the surrounding features
    3. The atlas page for that feature will be skipped

Further reading:

Click here to download the sample data for the lesson.