Making a Map Layout in QGIS

You are here:
< All Topics
image_pdfDownload as PDF

aWhere Training Tutorial

Introduction

This tutorial aims to get you started with making a professional map that includes a legend and other cartographic elements in one layout. You can add these maps to your reports, bulletins, and use them to help inform decisions based on weather patterns viewed in the maps.

Creating a Map Layout in QGIS

Please open the map you created in Tutorial: Using aWhere Data with QGIS. If you need to remake the map, please follow the earlier QGIS tutorial before starting here. For this training we will be using data from Zambia. Please make sure you have downloaded the most recent weather data files from the adaptER Platform and save them in your BaseData folder. Also, make sure you have the Zambia shapefile from the Global Administrative Areas (GADM) dataset. Your training folder should look similar to the screenshot here.

Once you have your data, you are ready to start mapping!
Below is the map we created in Using aWhere Data with QGIS. In this tutorial we will add a few contextual layers to the map before creating the layout.

Adding a Shapefile to the map

This first thing we want to do here is add a shapefile of administrative boundaries to our map. This helps identify regions of interest and can be used later to “subset” your county/district/ward/etc of interest to provide more focus on the map. This is the first dataset we will combine with aWhere’s datasets.

Tip: Want to know more about shapefiles? Read more here and here.

For the purpose of this exercise, the open-source Global Administrative Areas (GADM) dataset is used and it should be saved in your BaseData, Shapefiles subfolder. The GADM provides administrative boundaries for different levels of subdivision. The full Zambia dataset can be accessed through http://gadm.org/ if you do not have it.

For Zambia, the GADM data includes four levels of administrative boundaries: 

  • Level 0 – National
  • Level 1 – Province
  • Level 2 – District

There are two ways to load a shapefile into QGIS:

  1. Drag and Drop the files:
    1. Navigate to your Shapefile folder and drag the “gadm36_ZMB_0.shp” file to the Map Canvas window to import the national boundary into this project. Proceed to “drag and drop” the remaining files that have the extension .shp in your Shapefiles folder (gadm36_ZMB_1.shp, gadm36_ZMB_2.shp). Important: Only import .shp files! The other files in the folder are supporting functions of the shapefile and can be disregarded.
  2. Import the data using Data Source Manager:
    1. Click the Data Source Manager button () that we previously used to import the weather data files. 
    2. When this menu comes up, select Vector in the left menu – this reflects the type of dataset we are importing. Shapefiles are considered vector files. The .csv data we imported earlier are Delimited text files, thus we chose the option for “Delimited Text”:
    1. Use the gray box with 3 dots to navigate to where your shapefiles are saved on your computer and select the gadm36_ZMB_0.shp. Once selected, Click Add. 

Follow these steps to import the remaining two shapefiles (gadm36_ZMB_1.shp, gadm36_ZMB_2.shp)

For both of the above options, your end result should look like this (note that colors will vary, don’t worry, we will change them!):

gadm36_ZMB_0.shp: National

gadm36_ZMB_1.shp: Province

gadm36_ZMB_2.shp: District

You can see that these three shapefile layers have been added to my map in the Layers pane.

Next, let’s make these layers transparent so we can see the weather files underneath. GIS files are loaded as layers, with the top layer being the first visible layer in your map window, thus if it is transparent, we will be able to see the layers below it.

First, double click on the gadm36_ZMB_0 file.

The Layer Properties window will pop-up (below). Make sure the Symbology option is selected on the left menu.

  1. Select Simple Fill
  2. Click the arrow at the end of the option Fill color (see below).
  1. Check the box for transparent fill – this will keep the outline but make the interior transparent to enable us to see the layers underneath.
  1. Option to change the Stroke width and stroke color in the Layer Properties. We suggest you change the stroke width and/or color depending on the level of the administrative boundary. This helps you differentiate the boundaries when looking at all of them at the same time. For example, the color of the 0-level would be thicker (1mm), 1-level would be slightly thinner (0.5mm) and the 3-level would be the thinnest (Hairline).
  2. Follow the above steps to change the settings on your additional shapefile layers. Your map should now look something like this:

Note that you also have the option to add a basemap to your main map. You saw this in the earlier tutorial. Please add your basemap from the XYZ tiles in the Browser pane at this time if you would like to proceed with it as part of your layout!

Adding your locations file into the map (Optional)

Remember those locations files you created back in the Tutorial: Generating Locations File in QGIS? Well, they will help add additional context to our map if we import them as a Delimited Text file. Note, only import these locations if you intend to use one or more of the charts you created in the previous tutorial to point to trends in certain locations. 

For example, if you wanted to create a report that had a map and a chart on it, then you would add the locations file to the map and create a report that looked something like the image below. See the arrow pointing to the location on the map? This matches the location on the chart!

This is where the real power of leveraging both R and QGIS together starts to grow: Building a nice map PLUS adding detailed analysis with a trend chart for your locations of interest and says “this is the weekly precipitation in that exact location for this time period” – powerful stuff!

Steps:

  1. Click the Data Source Manager button () that we previously used to import the weather data files and the shapefiles.
  2. Make sure Delimited Text is selected on the left menu and load your locations file (Hint, it is saved in your RunSet folder!) 
  3. Once your locations are loaded, you can add labels and change the symbology by double-clicking the layer in the Layer Pane and navigating through the options on the main menu. 
    • To add labels: Double-click the file then choose Labels on the menu, then select Single labels on the drop-down menu. This should automatically choose the column “place_name” as your label title. You can then change the font, style, and size of your labels to make sure they are clearly seen on your map. You can also change the placement of the label (placement option in the menu on the left below).
  • If you would like to change the symbology of your points (i.e. perhaps you want a larger circle, or a different shape), double click on the layer and open the Symbology menu. You can change the options in the image below:

Tip: Make sure your labels, colors, and shapes of your symbols make sense for your analyses and are clear to the audience! Keep the colors dark and make sure they do not take away too much focus from the rest of the map.

Making a map layout

Now that you have your weather data files, boundaries, and your locations added to your map, you are ready to make a layout that includes a legend, north arrow, and text. 

  • Find the Print Layout button on your toolbar () or go to Project → New Print Layout from your main menu.
  • You will be prompted to create a print layout title, call it aWhereZambiaMap or something that makes sense to you!
  • You should have a blank canvas like this:
  • ADD MAP: First, we need to add our map to this layout. From the toolbar on the left side of the layout, select the Add Map button (). You can then click and drag on your blank canvas to create your map layout. Here is an example of what you might have:
  • TITLE: Next, let’s add a title to the map. To add a text box, click the Add Label button () on the left menu. As before, you click and drag to create a text box on your map layout. You can use the Select/move item tool () to move the text box to a new spot on your layout. Once you create your text box it will have default language – right click on the text box to bring up the Item Properties pane (shown below) to type your new title. In this map, we are visualizing the 200219_past30-PPETdiffNormal layer (P/PET difference from long-term normal for January 17-Feb 18, 2020). We added this layer in an earlier tutorial. The title of this map will be Zambia: Precipitation over Potential Evapotranspiration (P/PET) Difference from the Long-term Normal.

Once you add your own title to the text box, you can now start to change the formatting. You can choose a new font and make the size larger using the options seen above in the Item Properties menu. 

Please create the following two text boxes and change their font accordingly:

  1. The subheading will be the time period: January 17, 2020 – February 18, 2020.  
  2. Additional text boxes could add information such as The long-term normal is based on data from 2006-2019.

Once you have added the above text boxes, your map layout should look something like this:

  • LEGEND: The next element we need to add is the Legend. The Legend is a critical piece of information to ensure the viewer can interpret the map. Click the Legend button () and “draw” the box on your map. You may notice that the legend includes elements not see in this map layout – not to worry, we will edit the Legend so it is clear and accurate! 
    • Right click on your Legend and select Item Properties. Once again, this is where we will edit all of the elements. Follow the steps below to format your legend:

1. Add title →  Legend
2. Check the box Auto Update
3. Check the box “Only show
items inside linked map”
(this will limit the legend items to
those seen in the map!)
4. Expand the Fonts options and
start choosing different fonts for your Legend items!

5. Change the titles of your layers to
be more intuitive to your audience.
Double click on the legend item that
you would like to rename.
The window Legend Item Properties
will appear – you can rename the
layer accordingly. 

For the administrative boundaries,
you can rename them according to
the level of administrative zone
(i.e. Province, District for Zambia).

6. Your Legend should look something
like this – notice how the layers
have been renamed to be more logical.
  • Optional elements include:
    • North arrow ()
    • Scale bar for additional cartographic detail using the Scale bar button ()
    • Images such as your logo with the Import Image button ()

Tip: If you need to move your map around to make room for other elements use the Move Item Content button()

Once you have formatted the elements in your map layout, you are ready to export it as a JPEG or PNG to be added to your report, bulletin, Powerpoint, website, and more! On the top toolbar, located the Export as Image button (). This will prompt you to save the map, navigate to your training folder and save the PNG or JPEG to the QGIS folder.

Press Save on the next window for Image settings and then go to your folder to see your map. Your map should look something like this!

Now that you have one map, we suggest you continue to make maps for the remaining weather data layers in your QGIS main map. These include current precipitation, current P/PET, and precipitation difference from the long-term normal. This collection of maps can make an informed report that shows the current conditions as well as the trends compared to the historical averages or totals.  

Additionally, you can make maps for the forecast data too using the weather data files for the next 7, next 8-15, or next 15-day forecast. This is useful for when you are monitoring the onset and progression of the rainy season in your area of interest! Use this to alert farmers and extension agents that the rains are or aren’t expected. This helps de-risk agriculture in the context of climate change and builds resilience to weather variability.

What’s next? 

At this point in the tutorial series you have created many useful maps, charts, and figures. How should you use them to inform data driven-decisions? The next tutorial will show you quick ways to combine the R and QGIS outputs into a case study, report, and more. Review the next tutorial in the series Tutorial: Using aWhere’s outputs in Reporting.

If you have any questions, please contact customersupport@awhere.com

Was this article helpful?
4 out Of 5 Stars
5 Stars 0%
4 Stars 100%
3 Stars 0%
2 Stars 0%
1 Stars 0%
How can we improve this article?
Table of Contents