16
Making a Map Layout in QGIS 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.

Making a Map Layout in QGIS

  • Upload
    others

  • View
    9

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Making a Map Layout in QGIS

Making a Map Layout in QGISaWhere Training Tutorial

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

Creating a Map Layout in QGISPlease open the map you created in Tutorial: Using aWhere Data with QGIS. Ifyou need to remake the map, please follow the earlier QGIS tutorialbefore starting here. For this training we will be using data from Zambia.Please make sure you have downloaded the most recent weather data files fromthe adaptER Platform and save them in your BaseData folder. Also, make sure youhave 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 wewill add a few contextual layers to the map before creating the layout.

Page 2: Making a Map Layout in QGIS

Adding a Shapefile to the mapThis first thing we want to do here is add a shapefile of administrative boundariesto 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 themap. 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, Shapefilessubfolder. The GADM provides administrative boundaries for different levels ofsubdivision. The full Zambia dataset can be accessed through http://gadm.org/ ifyou do not have it.

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

Level 0 – NationalLevel 1 – ProvinceLevel 2 – District

There are two ways to load a shapefile into QGIS:

Drag and Drop the files:1.Nav iga te t o your Shape f i l e f o l de r and d rag the1.“gadm36_ZMB_0.shp” file to the Map Canvas window to import

Page 3: Making a Map Layout in QGIS

the national boundary into this project. Proceed to “drag anddrop” the remaining files that have the extension .shp in yourShapefiles folder (gadm36_ZMB_1.shp, gadm36_ZMB_2.shp).Important: Only import .shp files! The other files in the folder aresupporting functions of the shapefile and can be disregarded.

Import the data using Data Source Manager:2.

Click the Data Source Manager button ( ) that we previously1.used to import the weather data files. When this menu comes up, select Vector in the left menu – this2.reflects the type of dataset we are importing. Shapefiles areconsidered vector files. The .csv data we imported earlier areDelimited text files, thus we chose the option for “Delimited Text”:

Use the gray box with 3 dots to navigate to where your shapefiles1.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 thatcolors will vary, don’t worry, we will change them!):

gadm36_ZMB_0.shp: National

Page 4: Making a Map Layout in QGIS

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 theLayers pane.

Page 5: Making a Map Layout in QGIS

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

First, double click on the gadm36_ZMB_0 file.

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

Select Simple Fill1.Click the arrow at the end of the option Fill color (see below).2.

Check the box for transparent fill – this will keep the outline but make the3.

Page 6: Making a Map Layout in QGIS

interior transparent to enable us to see the layers underneath.

Option to change the Stroke width and stroke color in the Layer4.Properties. We suggest you change the stroke width and/or colordepending on the level of the administrative boundary. This helps youdifferentiate 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-levelwould be slightly thinner (0.5mm) and the 3-level would be the thinnest(Hairline).Follow the above steps to change the settings on your additional shapefile5.layers. Your map should now look something like this:

Page 7: Making a Map Layout in QGIS

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

Adding your locations file into the map(Optional)Remember those locations files you created back in the Tutorial: GeneratingLocations File in QGIS? Well, they will help add additional context to our map ifwe import them as a Delimited Text file. Note, only import these locations if youintend to use one or more of the charts you created in the previous tutorial topoint 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 lookedsomething like the image below. See the arrow pointing to the location onthe map? This matches the location on the chart!

Page 8: Making a Map Layout in QGIS

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

Steps:

Click the Data Source Manager button ( ) that we previously used to1.import the weather data files and the shapefiles.Make sure Delimited Text is selected on the left menu and load your2.locations file (Hint, it is saved in your RunSet folder!) Once your locations are loaded, you can add labels and change the3.symbology by double-clicking the layer in the Layer Pane and navigatingthrough the options on the main menu.

To add labels: Double-click the file then choose Labels on themenu, then select Single labels on the drop-down menu. Thisshould automatically choose the column “place_name” as yourlabel title. You can then change the font, style, and size of yourlabels to make sure they are clearly seen on your map. You canalso change the placement of the label (placement option in themenu on the left below).

Page 9: Making a Map Layout in QGIS

If you would like to change the symbology of your points (i.e. perhaps youwant a larger circle, or a different shape), double click on the layer andopen the Symbology menu. You can change the options in the imagebelow:

Tip: Make sure your labels, colors, and shapes of your symbols make sense foryour analyses and are clear to the audience! Keep the colors dark and make sure

Page 10: Making a Map Layout in QGIS

they do not take away too much focus from the rest of the map.

Making a map layoutNow that you have your weather data files, boundaries, and your locations addedto 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 wil l be prompted to create a print layout t it le, cal l i taWhereZambiaMap 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 canthen click and drag on your blank canvas to create your map layout. Hereis an example of what you might have:

Page 11: Making a Map Layout in QGIS

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 tocreate 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 youcreate your text box it will have default language – right click on the textbox to bring up the Item Properties pane (shown below) to type your newtitle. In this map, we are visualizing the 200219_past30-PPETdiffNormallayer (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 willbe Zambia: Precipitation over Potential Evapotranspiration (P/PET)Difference from the Long-term Normal.

Page 12: Making a Map Layout in QGIS

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

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

The subheading will be the time period: January 17, 2020 – February1.18, 2020. Additional text boxes could add information such as The long-term2.normal is based on data from 2001-present year.

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

Page 13: Making a Map Layout in QGIS

LEGEND: The next element we need to add is the Legend. The Legend isa critical piece of information to ensure the viewer can interpret the map.

Click the Legend button ( ) and “draw” the box on your map. You maynotice that the legend includes elements not see in this map layout – notto worry, we will edit the Legend so it is clear and accurate!

Right click on your Legend and select Item Properties. Onceagain, this is where we will edit all of the elements. Follow thesteps below to format your legend:

1. Add title → Legend2. Check the box Auto Update3. 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 Legenditems!

Page 14: Making a Map Layout in QGIS

5. Change the titles of your layers tobe more intuitive to your audience.

Double click on the legend item thatyou would like to rename.

The window Legend Item Propertieswill 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 somethinglike 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 toexport 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 savethe PNG or JPEG to the QGIS folder.

Page 15: Making a Map Layout in QGIS

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

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

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

Page 16: Making a Map Layout in QGIS

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

If you have any questions, please contact [email protected]