6 Exercise 5: Print layout

6.1 Exercise content

This exercise focuses on QGIS’ print layouts and the map atlas functionality.

6.2 The goal of the exercise

You know how to produce a print layout. You also know how to export print layouts as PDF files.

6.3 Preparations

Open the previous QGIS project with visualized New York population data and add the following datasets to your project.

  • ..course_directory/ny_gov/ny_districts.gpkg

  • A background map of your liking, for example Browser > XYZ Tiles > OpenStreetMap

6.5 Bonus: Map atlas

The map atlas is a functionality that allows us to automatically produce a large number of maps on the same theme. In the following example we will be producing a map atlas of the districts of New York to see how the population is distributed on district level. Our goal is to produce a total of 71 maps, one for every district. Set the ny_districts layer visible together with the population_ny and OpenStreetMap layers. Set the ny_districts layer on top of the two other layers and visualize it with a transparent fill and a visible outline.

Create a new print layout. Add a new map item that has all three layers visible. Add a title, a legend, a scale bar and other cartographic or graphic items (such as a logo or a north arrow) that you’d like to the map. Set the scale of the map so that it can fit about one district (for example 1:130 000) because in the result the atlas features are automatically sized based on the sizes of the districts. Your print layout should look something like this at this point:

Let’s begin producing the map atlas. The map atlas functionality must be activated first before it can be used in the print layout window. From the top menu select Atlas > Atlas settings. The atlas tab appears on the right side of the window. In the atlas tab, check the Generate an atlas box. Set the Coverage layer to be the layer with the regions on which the map is based on - in this case that would be the ny_districts layer.

Make sure that the map item is activated, if it is not, activate it by clicking on it with the Select/Move item toolfound in the left toolbar. From the Item Properties select Controlled by Atlas.

With the Clipping settings You can select which layers to clip to atlas features. Clipping all layers results in nothing but the selected district being visible in the atlas, while leaving the background unclipped gives more context to the map.

You can view your atlas by selecting Atlas > Preview atlas in the top menu bar. You can use the preview to monitor what the atlas looks like while you are making changes. Use the arrows in the preview toolbar up top to move between atlas pages. Notice that you can edit the print layout and the map while simultaneously seeing the results update live in the preview.

Lets add an index map to our print layout by selecting the Add Map tooland adding a smaller map item next to our main map. The index map acts as an overview and shows us where the map atlas is focused. Activate the index map item and navigate to Item properties > Overviews and add an overview with the plus sign. Configure the settings as follows:

If you want, you can try editing the index map’s frame style. Also try switching pages in the atlas preview and notice how the frame of the index map follows the main map. Once you are done, you can print the map atlas with the Export atlas tool. Notice that every page of the atlas must be drawn when exporting - this may take a bit of time.

You can export your atlas either as separate images or as a single PDF file. Exporting as a single file can be done by navigating to the Atlas tab and enabling the Single file export when possible option.

A page of the finished map atlas could look like this, for example:

Notice how the index map is automatically updated for every page of the atlas.

Once you are done, save the project file into the course directory either by selecting Project > Save from the menu bar or by pressing CTRL + S.