5 Processing data

We saw in Chapter … how to style and select features of interest from layers loaded into QGIS. In this section, we will learn how to process data. That means creating new data from existing data.

5.1 Reprojecting Data

Our two spatial datasets have different coordinate systems. This can make it difficult to make connections between the datasets. So we will reproject the stats19 data to the British National Grid.

In the vector, menu select Data management Tools, Reproject Layer

Reproject Menu

Figure 5.1: Reproject Menu

Reproject MenuCordiante Reference System

Figure 5.2: Reproject MenuCordiante Reference System

5.2 Joining Data

Joining data allows you to link two separate datasets together by something they have in common. There are two types of join. Attribute joins (often just called joins) link two datasets by a common attribute such as an ID number. Spatial joins link dataset by a shared location.

In this next section, we will use a series of joins to find the area of Leeds with the highest rate of road collisions.

5.2.1 Attribute Joins

We will join the population data onto the LSOA boundaries.

Find “leeds_lsoa” in the Layers panel and right-click to bring up the context menu

Click on Properties

Select Joins from the options on the left

Click the green + button to open the Add Vector Join window

Select the following options:

Join layer: population

Join field: area

Target field: lsoa11cd

Click OK,

Click OK again

The Add Vector Join window

Figure 5.3: The Add Vector Join window

Use the “Identify features” tool to see that each LSOA now has a population value.

5.2.2 Spatial Joins

We will assign an LSOA ID number to each road collision by doing a spatial join.
In the “Vector” menu, select “Data Management Tools”, then “Join Attributes by Location”.

Join Attributes by Location

Figure 5.4: Join Attributes by Location

In the Vector Menu, select Data Management Tools, Select Attributes by location, as shown in 5.5.

Join Attributes by Location Window

Figure 5.5: Join Attributes by Location Window

For the Input Layer select “stats19” and for the output later select “leeds_lsoa”. For join type select “Create separate feature of each located feature”. Then click run.

Join Results

Figure 5.6: Join Results

Once the process has completed a new layer will have been added to the map called “joined Layer” you can use the “Identify features” tool to see that each point in the stas19 data now has the

5.3 Points in Polygons

The final step for this chapter will be to count the number of road crash casualties in each LSOA.

In the Vector Menu, select Analysis Tools, Count Points in Polygons.

Points in Polygons Tool

Figure 5.7: Points in Polygons Tool

For the Polygons choose your LSOA areas and the points the stats19 data. USe the number of casualties as a weighting field, and give the “count field name” an appropriate name.

A new layer will be created with the number of casualties for each LSOA. USe Symbology to visualise the most dangerous areas of Leeds.

Number of road crash casualties in Leeds

Figure 5.8: Number of road crash casualties in Leeds

5.4 Summary

Before moving onto the next chapter make sure you have.

  1. Reprojected the stats19 data to the British National Grid
  2. Done an attribute join of the population data to the LSOA areas
  3. Done a spatial join of the LSOA areas to the stats19 points
  4. Counted the number of casualties in each LSOA

Bonus Exercises

  1. Can you use symbology to show the population of each LSOA?
  2. Can you use symbology to show the number of casualties in each LSOA?