“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.
Goal: To produce a map series showing water resources in the context of agricultural lands.
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 |
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.
An atlas is:
What will happen if you delete one of the grid polygons from your coverage layer:
Download the sample data for the lesson.