Geoprocessing tools and spatial analysis

There are so many 'tools' and options for spatial analysis in QGIS that it is difficult to select just a few examples for an introductory tutorial. This page aims to cover the following:

  • A quick introduction to geoprocessing tools in QGIS and how to find them

  • An exercise aiming to find out 'how many penguin colonies are within a set distance of a research station in Antarctica'

  • A link to an exercise calculating areas of an iceberg with useful information about what to consider when calculating areas of features (if time allows)

Geoprocessing tools in QGIS

Spatial analysis uses spatial information to extract new and additional meaning from GIS data. GIS Applications normally have spatial analysis tools for feature statistics (e.g. how many vertices make up this polyline?) or geoprocessing such as feature buffering. The types of spatial analysis that are used vary according to subject areas.

A few of the most common geoprocessing and analysis tools are shown below for vectors and for rasters. We only get the chance to cover a couple of these tools in this tutorial, but it is useful to know that these tools exist and to think about some of the applications that they could have.

Have a quick look at the following images, and then get started with the exercise below!

Exercise 1 - penguins!

For this exercise, we are going to use a penguin location dataset from the MAPPPD project (Mapping Application for Penguin Populations and Projected Dynamics). We want to work out which penguin locations are within 30 km of a research station.

This kind of work can have many different applications - how many fuel depots are within a certain distance of a location, how many bird nesting sites are within an area of planned development, how many ice cores have been taken within a certain distance of a newly planned site, etc.

  1. We will continue working in your main QGIS project for this exercise. Open this up if it is closed. In the Layers panel, turn off or 'untick' all of the layers apart from the COMNAP facilities and the Antarctic coastline.

  2. Add the MAPPPD_penguins GeoPackage into your project. Your project should now look like the image below (probably with different colours), with 3 layers ticked on in the Layers panel.

Firstly, we want to create 'buffers' around the COMNAP stations/facilities. To do this, we need to define a distance which is the radius of the circle, or buffer, coming out from the point. It is easiest to think of this distance in metres or kms. However, our stations layer is currently in EPSG 4326 CRS, which uses geographic degrees and not metres. Therefore, we will reproject (change the CRS of) this dataset into EPSG 3031 (Antarctic Polar Stereographic), which measures in metres.

3. To reproject the data, we will use the Reproject Layer tool: Vector ➤ Data Management Tools ➤ Reproject (or search in the Processing Toolbox, on the right-hand side of your project).

4. Select the facilities as your Input layer. Select EPSG 3031 as the Target CRS. Where it says [Create temporary layer], we want to in fact create a permanent layer, so we click on the ... to the right of this, and then select 'Save to File' and save the new file in your data file with the same name but with '3031' added onto the end. (Note: we could also have saved this file into the original GeoPackage, as GeoPackages can contain multiple files inside).

5. Click 'Run' and after a few seconds, your new file should appear in the Layers panel. Close this tool if it doesn't close automatically.

6. Now that we have this dataset in EPSG 3031 which measures in metres, we can use the Buffer tool successfully. The tool can be found under Vector ➤ Geoprocessing Tools ➤ Buffer, or by searching in the Processing Toolbox. Open the tool.

7. Select your new facilities file as the Input Layer. Select a distance of 30 km. Leave the other parameters as default. Save the output as a new file again, named something with buffer in the name. Click 'Run'.

Note: if you had not changed the CRS of your dataset, a warning would have appeared saying 'Distance is in geographic degrees. Consider reprojecting to a projected local coordinate system for accurate results'.

8. Your buffer output should now appear in your Layers panel and you should be able to see all of the circles on your map.

We will now work out which of the penguin sites intersect these 30 km buffers. There are a few different ways to do this.

9. We are about to use a tool that uses both the penguin sites and the buffers. Ideally, we want both datasets to be in the same CRS but at the moment they are not. The facilities buffers are in EPSG 3031 but the penguins are in EPSG 4326. Therefore, we want to reproject the penguins into 3031. Do this, the exact same way you did it for the facilities above (steps 3-5). You should end up with the MAPPPD penguins geopackage in EPSG 3031.

10. Now will first use the 'Clip' tool. This 'clips' or 'selects' all of the data that falls within another dataset. The tool can be found at Vector ➤ Geoprocessing Tools ➤ Clip. Fill the parameters as below, and have a look at the output. Make sure you untick the full penguin dataset to see the new output. You should be able to see that it now contains only the points within the 30 km buffers.

This is useful for a visual representation, but another process that is useful, is to work out how many points fall within each buffer. So that you could answer the more specific question of 'how many penguin sites are within 30 km of Rothera?', for example.

This can be done with the 'Count Points in Polygon' tool, located at Vector ➤ Analysis Tools ➤ Count Points in Polygon.

11. Open this tool and set the parameters as shown below. Click 'Run'.

12. A new polygon dataset will be added to your Layers panel. Open the Attribute Table of this new file (Right click on the layer ➤ Open Attribute Table). If you scroll right across to the furthest right field, you will see that a new one has been added called 'NUMPOINTS' (as we specified above).

13. Find Rothera station in the Attribute Table, or use the 'Identify' tool as previously described. If you use the Identify tool, you will also identify the Dirck Gerritsz Laboratory, which covers an almost identical region. How many penguin sites are located in the 30 km buffer?

Hopefully you can see the use in some of these processes for further applications. There are a whole variety of different tools which can be extremely powerful.

Penguin dataset source:

MAPPPD, Version 3.0 Last updated: April 2, 2019, http://www.penguinmap.com/mapppd, https://doi.org/10.1017/S0032247417000055

Exercise 2 - A68 iceberg area calculations

When completing this tutorial in a MAGIC-led session, we might not have time for this exercise, but I am adding this link in case we do.

We have started the development of a MAGIC portfolio of training and tutorials, The link below provides an extra exercise for calculating areas in QGIS. If you have time after finishing the first exercise, then open this up and have a go at it.

https://guides.geospatial.bas.ac.uk/geospatial-tutorials/spatial-analysis/area-calculation-in-qgis

Last updated