eyecatch

Batch Export Maps with the QGIS Atlas Tool

Published: Last updated:
This article uses QGIS 3.40. The current LTR is 3.44.

What you'll learn


  • The basic mechanics of the QGIS atlas tool and how to set it up
  • How to export maps automatically, driven by a print layout
  • How to generate multiple PDF or image files in one batch

Recommended for


  • Anyone who wants to export a map for each administrative area in one batch
  • Anyone who wants to print or save many maps efficiently
  • Anyone who creates reports or handouts in QGIS

Introduction

Have you ever wanted to use the QGIS print layout to efficiently create a large number of maps with the same layout, such as one map per municipality or one per location in a customer list? The atlas tool built into QGIS is a powerful way to generate standardized maps like these automatically.

This article walks through the atlas tool step by step, from basic usage to advanced techniques.

To use the atlas tool, you first need to set up the look of your map in a print layout. If you want to learn the basics of print layouts, see this article.

What the atlas tool can do

The atlas tool mainly lets you do the following.

Automatic map generation:

For each feature in the layer you specify, QGIS generates maps one after another, automatically changing the center and extent of the map.

Dynamic labels:

The title and description change automatically for each map (for example, “XX City Surrounding Area Map”).

Batch export:

You can export the large number of generated maps in one batch as PDF or image files. This greatly improves productivity, prevents manual errors, and keeps quality consistent.

Maps exported in one batch with the atlas tool. Adapted from “National Land Numerical Information (Administrative Area Data)” (Ministry of Land, Infrastructure, Transport and Tourism)
Maps exported in one batch with the atlas tool. Adapted from “National Land Numerical Information (Administrative Area Data)” (Ministry of Land, Infrastructure, Transport and Tourism)

Basic setup of the QGIS atlas tool

Prepare the print layout

This example uses the municipality polygons of Aichi Prefecture downloaded from National Land Numerical Information to show how to create a map for each municipality.

Municipality polygons of Aichi Prefecture. Adapted from “National Land Numerical Information (Administrative Area Data)” (Ministry of Land, Infrastructure, Transport and Tourism)
Municipality polygons of Aichi Prefecture. Adapted from “National Land Numerical Information (Administrative Area Data)” (Ministry of Land, Infrastructure, Transport and Tourism)

First, click Project → New Print Layout in the menu bar. Enter a name for the layout and click OK.

Click New Print Layout
Click New Print Layout

When the print layout window opens, place a basic Map item.

Add a Map item to the layout. Adapted from “National Land Numerical Information (Administrative Area Data)” (Ministry of Land, Infrastructure, Transport and Tourism)
Add a Map item to the layout. Adapted from “National Land Numerical Information (Administrative Area Data)” (Ministry of Land, Infrastructure, Transport and Tourism)

Enable the atlas tool

Now set up the atlas tool. With the Map item selected, open the Atlas tab in the panel on the right side of the window and check Generate an atlas at the top of the panel.

Check Generate an atlas
Check Generate an atlas

The settings become active. Configure them as follows.

  1. Coverage layer: Select the layer that defines the extent of each map (the coverage layer). QGIS creates one map for each feature in the layer you specify here. This example uses the 行政区域 layer (administrative areas).
  2. Page name (optional): Specify the page name of each exported map. It helps to use a field that holds the name of each feature in the coverage layer (for example, the municipality name). This example selects N03_004, the field that stores the municipality name.
  3. Output filename expression (optional): If the atlas exports separate files, you can set their file names. For example, to name the output files output_<municipality name>.xxx, enter the expression 'output_' || "<field name for the municipality name (N03_004)>".
  4. Single file export when possible (optional): To get a separate file for each map, clear the check box. This example clears it.
In expressions, text in double quotes (") refers to a field, and text in single quotes (') is entered as a literal string. The || operator joins strings. You can also click the ε button to open the expression dialog, which makes it easier to enter symbols and other elements.
Settings for the layer and output files used by the atlas
Settings for the layer and output files used by the atlas

Next, link the Map item to the atlas so that it follows the coverage layer you just set. With the Map item selected, check Controlled by Atlas on the Item Properties tab.

Check Controlled by Atlas
Check Controlled by Atlas

Preview the atlas

The basic setup is complete. Now preview how the maps are generated. On the menu bar, choose Atlas → Preview Atlas.

Choose Preview Atlas
Choose Preview Atlas

QGIS redraws the map, centered on a feature of the layer you set as the coverage layer.

The map is redrawn based on the atlas settings. Adapted from “National Land Numerical Information (Administrative Area Data)” (Ministry of Land, Infrastructure, Transport and Tourism)
The map is redrawn based on the atlas settings. Adapted from “National Land Numerical Information (Administrative Area Data)” (Ministry of Land, Infrastructure, Transport and Tourism)

Click the arrow buttons (▶ and ◀) on the toolbar to step through the features of the coverage layer one by one and check each generated map.

Click the arrow buttons to switch between atlas pages
Click the arrow buttons to switch between atlas pages

Add dynamic text (labels)

Next, set up the print layout so that the title changes automatically for each map. Add a Label item wherever you like and adjust settings such as the font size.

Add a Label item. Adapted from “National Land Numerical Information (Administrative Area Data)” (Ministry of Land, Infrastructure, Transport and Tourism)
Add a Label item. Adapted from “National Land Numerical Information (Administrative Area Data)” (Ministry of Land, Infrastructure, Transport and Tourism)

With the Label item selected, delete the default text (Lorem ipsum) in the text box under Main Properties in Item Properties. Then click the Insert/Edit Expression button below it.

Delete the default text and click the Insert/Edit Expression button
Delete the default text and click the Insert/Edit Expression button

As an example, enter the expression "<field name for the municipality name (N03_004)>" || '周辺地図' so that each title reads the municipality name followed by 周辺地図 (“surrounding area map”), then click the OK button. Replace the field name placeholder in the expression with the name of the field you want to show in the layout, such as a name field in the coverage layer.

To enter a field name easily, expand Fields and Values in the list in the middle and double-click the field you want.
Enter the expression
Enter the expression

Now, based on the expression, the attribute value you specified from the coverage layer appears as the title.

The feature's attribute value appears in the title. Adapted from “National Land Numerical Information (Administrative Area Data)” (Ministry of Land, Infrastructure, Transport and Tourism)
The feature's attribute value appears in the title. Adapted from “National Land Numerical Information (Administrative Area Data)” (Ministry of Land, Infrastructure, Transport and Tourism)

Export the atlas

If the preview looks fine, export the atlas.

From the Atlas menu on the menu bar, choose Export Atlas as Images or Export Atlas as PDF, depending on the output format you want. This example uses Export Atlas as Images.

Click Export for the output format you want
Click Export for the output format you want

Specify where to save the files, set the export options, and click the Save button.

Click the Save button
Click the Save button

When the export finishes, check the files. QGIS has created one map for each feature of the coverage layer.

The maps are exported in one batch. Adapted from “National Land Numerical Information (Administrative Area Data)” (Ministry of Land, Infrastructure, Transport and Tourism)
The maps are exported in one batch. Adapted from “National Land Numerical Information (Administrative Area Data)” (Ministry of Land, Infrastructure, Transport and Tourism)

Advanced uses of the atlas tool

The atlas is a handy way to export maps in the same style in one batch. Here are a few more advanced ways to use it.

Add an overview map

The atlas creates each print layout for the area of a coverage layer feature. So adding an overview map that shows where that area sits within the whole area makes the map easier to understand.

First, add another small Map item to the print layout and adjust its scale as needed. This is the overview map.

Add a Map item for the overview map. Adapted from “National Land Numerical Information (Administrative Area Data)” (Ministry of Land, Infrastructure, Transport and Tourism)
Add a Map item for the overview map. Adapted from “National Land Numerical Information (Administrative Area Data)” (Ministry of Land, Infrastructure, Transport and Tourism)

In the Item Properties of the Map item you added as the overview map, expand Overviews and click the + button. Then, for Map frame, select the main Map item (such as Map 1).

Set up the overview map
Set up the overview map

The overview map now shows the area displayed in the main map as a red frame.

The area displayed in the main map is marked with a red frame on the overview map. Adapted from “National Land Numerical Information (Administrative Area Data)” (Ministry of Land, Infrastructure, Transport and Tourism)
The area displayed in the main map is marked with a red frame on the overview map. Adapted from “National Land Numerical Information (Administrative Area Data)” (Ministry of Land, Infrastructure, Transport and Tourism)

Show attribute information of the coverage layer

A print layout can display an attribute table, and you can control which features it shows in sync with the atlas.

First, add an Attribute Table item to the print layout.

Add an Attribute Table item. Adapted from “National Land Numerical Information (Administrative Area Data)” (Ministry of Land, Infrastructure, Transport and Tourism)
Add an Attribute Table item. Adapted from “National Land Numerical Information (Administrative Area Data)” (Ministry of Land, Infrastructure, Transport and Tourism)

In the Item Properties of the Attribute Table item, expand Feature Filtering and check Show only features intersecting atlas feature.

Check Show only features intersecting atlas feature
Check Show only features intersecting atlas feature

The table is now filtered to show only the features that intersect the atlas feature.

Only the features that intersect the atlas feature are shown. Adapted from “National Land Numerical Information (Administrative Area Data)” (Ministry of Land, Infrastructure, Transport and Tourism)
Only the features that intersect the atlas feature are shown. Adapted from “National Land Numerical Information (Administrative Area Data)” (Ministry of Land, Infrastructure, Transport and Tourism)

You can also limit the attribute table to the atlas feature only. In the Feature Filtering group, check only Filter with and enter $id = @atlas_featureid as the expression.

$id = @atlas_featureid is an expression that shows only the feature with the same ID as the current atlas feature. All functions that start with atlas_ relate to the atlas.
Check Filter with and enter the expression
Check Filter with and enter the expression

Now only the atlas feature appears in the attribute table.

Only the atlas feature appears in the attribute table. Adapted from “National Land Numerical Information (Administrative Area Data)” (Ministry of Land, Infrastructure, Transport and Tourism)
Only the atlas feature appears in the attribute table. Adapted from “National Land Numerical Information (Administrative Area Data)” (Ministry of Land, Infrastructure, Transport and Tourism)

Show only the atlas feature on the map

Before you export the atlas, you can set the style of the coverage layer so that only the atlas feature is displayed.

First, open the layer properties, go to the Symbology tab, choose Rule-based, and double-click where (no filter) appears.

The Rule-based settings
The Rule-based settings

The Edit Rule dialog opens. In Filter, enter $id = @atlas_featureid.

Enter the expression in Filter
Enter the expression in Filter

When you finish, close the layer properties. Then open the print layout where you set up the atlas from the Layout Manager. Only the atlas feature is displayed, and the surrounding municipality polygons are hidden.

Only the atlas feature is displayed. Adapted from “National Land Numerical Information (Administrative Area Data)” (Ministry of Land, Infrastructure, Transport and Tourism), with GSI Tiles (Geospatial Information Authority of Japan) as the background
Only the atlas feature is displayed. Adapted from “National Land Numerical Information (Administrative Area Data)” (Ministry of Land, Infrastructure, Transport and Tourism), with GSI Tiles (Geospatial Information Authority of Japan) as the background

You can also add another rule to change the style of everything other than the atlas feature. Click the + button to add a new rule and set the expression $id != @atlas_featureid.

Add a new rule and enter the expression
Add a new rule and enter the expression

You can see that different styles are applied to the atlas feature and the other features.

Different styles are applied to the atlas feature and the other features. Adapted from “National Land Numerical Information (Administrative Area Data)” (Ministry of Land, Infrastructure, Transport and Tourism)
Different styles are applied to the atlas feature and the other features. Adapted from “National Land Numerical Information (Administrative Area Data)” (Ministry of Land, Infrastructure, Transport and Tourism)

Print a map for each grid cell

So far, you have created an atlas for each feature of the municipality layer. If you create a grid beforehand, you can also print a map for each grid cell.

On the menu bar, click Vector → Research Tools → Create grid.

Click Create grid
Click Create grid

Set Grid type to Rectangle (Polygon) and create a grid with whatever extent and size you like.

Set Grid type to Rectangle (Polygon) and create the grid
Set Grid type to Rectangle (Polygon) and create the grid

QGIS creates the grid.

The grid is created. Adapted from “National Land Numerical Information (Administrative Area Data)” (Ministry of Land, Infrastructure, Transport and Tourism)
The grid is created. Adapted from “National Land Numerical Information (Administrative Area Data)” (Ministry of Land, Infrastructure, Transport and Tourism)

Once the grid is ready, open a print layout and add a Map item and other items. Set up the atlas with the same steps as before, and select the Grid layer you created as the coverage layer.

Select the Grid layer you created as the coverage layer
Select the Grid layer you created as the coverage layer

When you preview the atlas, QGIS creates a map for each grid cell.

A map is created for each grid cell. Adapted from “National Land Numerical Information (Administrative Area Data)” (Ministry of Land, Infrastructure, Transport and Tourism)
A map is created for each grid cell. Adapted from “National Land Numerical Information (Administrative Area Data)” (Ministry of Land, Infrastructure, Transport and Tourism)

Fix the scale

By default, the atlas creates each map so that it surrounds the feature with the margin you specify. When you use a point layer or want maps at a specific scale, fixing the scale is useful.

To do this, select the Map item, check Controlled by Atlas in Item Properties, and select Fixed scale. This fixes the scale of all the maps.

Check Controlled by Atlas and select Fixed scale
Check Controlled by Atlas and select Fixed scale

To change the scale, adjust the Scale value in Item Properties.

Adjust the Scale value in Item Properties
Adjust the Scale value in Item Properties

Conclusion

The QGIS atlas tool is a very powerful way to streamline the creation of standardized maps. Mastering just the basic usage covered in this article will prove useful in many situations.

Combine it with advanced techniques, such as adding an overview map and showing attribute information, and you can create many clearer maps in a short time.

About the author
QGIS LAB Editorial Team
QGIS LAB Editorial Team

QGIS LAB is a comprehensive information hub for QGIS, the open-source GIS software. Under the concept of “Geospatial for Greater Good,” we share the knowledge and skills to open up the world through location data.