Mapping with QGIS

This exercise will show you how to make different kinds of maps in QGIS along with a few extra features. In particular, you will be able to:

  • Create a symbol map
  • Create a choropleth map
  • Label a map
  • Create a heat map
  • Save and retrieve a bookmark
  • Save your work as a project.

Create a Symbol Map

  1. Click the Add Vector Layer button: alt text and load the wyorkmap.shp and schools.shp shapefiles from the Exercise 2 folder (if not already loaded). Note that you can load both files at the same time by selecting them individually whilst holding down the shift key. Press Open twice to load the files. If you cannot see the schools, move the layer above wyorkmap.

  2. The points (schools) will have a default appearance. Double-click on the point symbol in the Layers window and examine what symbols are available.

    alt text

  3. Change the symbol type to a pentagon. To do this, click on Simple marker and the screen on the right will appear.

    alt text

  4. Change the size and fill colour as well. If you press Apply, these changes will be made while keeping this screen open.

  5. Although it might seem like there are very few symbols available, select SVG marker from the Symbol layer type dropdown on this Style screen. You should see a whole new set of symbols appear. Go through all the different possibilities. Can you find a school symbol? If you cannot find an exact symbol for a school, choose something appropriate for displaying your schools.

  6. If you want to add your own symbol, you can find SVG files on the internet or you can draw your own symbol with a drawing package, e.g. the freely available Inkscape, and save the symbol with the svg extension. SVG files are a type of graphic file (Scalable Vector Graphics). I have found a school.svg file for you and placed it in the Exercise2 folder. To use it, click on this icon: alt text in the Styles window and load the file. The symbol should appear on the left. Click on the Apply button to change the symbology.

Creating a Choropleth Map

We are now going to use a different data set of US states in order to create a choropleth map.

  1. Remove the schools and the wyorkmap layers from the Layers Panel and add the States.shp shape file to QGIS from the Exercise3 folder. You will see the outlines of the states of the USA but no other information yet displayed.

  2. Double-click on the map name in the Layers panel and go to the Style tab.

  3. Select Graduated from the drop down box at the top on the left hand side and change Column to POP07_SQMI (which is the population density in 2007).

  4. Select a New color ramp… from the Color ramp drop down box (at the bottom of the list). Choose Gradient and click OK. Leave the colours that are suggested and type in any name for your colour ramp. In the Classes tab underneath, change the mode to ‘Equal Interval’ and select ‘Classify’. You should now see a number of classes appear in the window underneath. Click OK to apply the changes.

  5. Go back to the Style tab and experiment with different types of Mode. What effect does this have on the map shading?

  6. Now go back to the Style tab and experiment with the number of classes. Each time you make a change, look at the effect that this has on the overall pattern that is displayed. What is the disadvantage of having a large number of classes?

  7. Now go back to the Style tab, choose a small number of classes (e.g. 3 to 5) and manually change the classes so they are round numbers, e.g. 5 to 10, 10 to 15, 15 to 20, etc. Do this by double clicking on the values and entering the lower and upper bounds.

Adding Labels to a Map

  1. Click on the Labelling icon alt text to add labels to your map. At the top left hand side of the window, select ‘Show labels for this layer’ in the drop down menu and below this select the name of the field to Label with (e.g. STATE_NAME). Click on the OK button.

  2. Does this put the labels in an ideal position?

  3. Click on the Labelling icon again and choose a different font and colour for the labels. Press the Apply button to see your changes and leave this window open.

  4. Now click on the word Placement on the left hand side. Change the Placement options. For example, what happens when you select ‘free (slow)’?

  5. In the Style tab of the Layer Properties of the States layer, change the transparency setting so that this layer appears much lighter.

Creating a Heat Map

Heat maps are a good way of analysing patterns in dense collections of points, e.g. crime data or an occurrence of a particular species. In this case let’s create a heat map of the cities in the USA to show where they are most densely clustered.

  1. Load the Cities shapefile found in the Exercise3 folder.

  2. Click on the heat map icon from Raster > Heatmap on the top menu alt text. NOTE: if the heatmap option is not under the Raster menu, click Plugins > Manage and Install Plugins >search for Heatmap and install the plugin.

  3. Select the Cities shapefile as the Input Point Vector and choose a name for the Output Raster, using Browse to choose where this is saved. Change the Radius to 500000m and click OK to start the process.

  4. The heat map will initially appear as a grey raster. Double-click on this layer to bring up the Properties box and display the Style. Change the Render type to Singleband pseudocolor.

  5. In the Generate new color map section of the screen, select New color ramp… from the first drop down. From this list choose ColorBrewer and press OK. Choose a colour ramp from the many choices available. Choose any name and press OK.

  6. Change Mode to Equal Interval and click on Classify. Click OK to close the Properties window.

  7. Where are the main clusters of cities in the USA?

  8. Now choose a different radius, e.g. 200000m and repeat the operation. What effect does this have on the final heat map?

  9. Although you can see these general patterns of city clustering by simply plotting the cities as symbols on the map of the US states, imagine that you have a dense cloud of points from which no obvious pattern appears. Then heat maps can help you find the patterns in the data. However, notice how the boundaries of the heat map go beyond the boundaries of the States shapefile? In the next few steps you will learn how to ‘clip’ the heat map with the States boundary file.

  10. Bring up the Processing Toolbox (Processing > Toolbox from the main menu).

  11. Find GDAL/OGR in the list in the Processing Toolbox and expand this list (ensure ‘Advanced interface’ is selected in the dropdown list at the bottom of the window). Find GDAL [Extraction] and expand the item.

  12. Click on Clip raster by mask layer. The input layer should be your heat map, the mask layer should be the States file and leave everything else as it is. Click Run to run the extraction. You can change the colour as you did before.

Save and Retrieve a Bookmark

Bookmarks are ways of saving and accessing spatial extents.

  1. Using the map files that are loaded, zoom into an area.

  2. From the main menu, click on the New Bookmark icon: alt text

  3. Enter a name that will help you remember what this bookmark is and click on the Close button.

  4. Zoom out to the Full Extent. Hint: see previous exercise if you cannot remember how to do this.

  5. Click on the Show Bookmarks icon: alt text. Find the bookmark you created, highlight it and click on Zoom to.

Save your Maps as Projects

You can save your mapping work as a project file (*.qgs), which allows you to save one or more maps together (including the symbology, shading, etc.).

  1. Select Project > Save As… from the main menu and save the file with this name: Exercise3.qgs.

  2. Select Project > New to clear the screen.

  3. Select Project > Open and find your project file. Reload it to make sure you are happy that your changes were saved. Project > Recent will also list recent projects and is a quick way to select your project files.

Now move on to exercise four