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
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
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”.
In the Vector Menu, select Data Management Tools, Select Attributes by location, as shown in 5.5.
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.
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.
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.
5.4 Summary
Before moving onto the next chapter make sure you have.
- Reprojected the stats19 data to the British National Grid
- Done an attribute join of the population data to the LSOA areas
- Done a spatial join of the LSOA areas to the stats19 points
- Counted the number of casualties in each LSOA
Bonus Exercises
- Can you use symbology to show the population of each LSOA?
- Can you use symbology to show the number of casualties in each LSOA?