Vector Analysis
What are we going to learn?
In this workshop, we will learn about:
- Importing data from a CSV
- Joining Tabular data
- Overlaps/Intersections
- Digitisation
- Point counts within a polygon
What is Vector Data?
Vector data is made up of points, lines, and/or polygons. They are made up of precise points with individual coordinates. Vector data is best contrasted with Raster data which has a grid of values evenly spaced apart, connected to one coordinate. Rasters are efficient at displaying large amounts of data, where vector data is very precise.
The Map School has some useful explainers of what Vector data is.
What are we doing in this session?
We’ve actually already looked at a lot of vector data: all our points, lines and polygons are vectors. To look at vector data in some more detail, we’re going to bring a CSV of animal sightings, use some analyses to see how they interact with our existing data, and create some spatial data of our own.
For this Windfarm to go ahead, we need to look at the environmental impacts on vegetation, animals, and people in the local area. We can calculate the area of vegetation impacted, count animal sightings, and in the next session look at population numbers.
Load in our data
- Click the
Project Homedropdown, thendata > raw > 2-vector_dataand load in:animal_sightings.csv(Animal sightings from iNaturalist)
For most spatial data, we will simply be able to double click on it in the Project Home folder within the Browser panel. But we need to handle CSV data differently. If you try to import it in the same way, it will add a layer to your project, but it is not a spatial layer: it in in essence an attribute table without geometries attached to it.
Importing CSV data
The animal sighting data has columns with coordinates so it effectively is spatial data, but we need to point QGIS to those columns by using these import steps:
- Go to
Layer > Add Layer > Add Delimited Text Layer... - Click the three dots
...next to the File name field, navigate to the project folder, and selectanimal_sightings.csv - Click the Geometry Definition drop down
- This should automatically identify Longitude as the X field, and Latitude as the Y field.
- You may need to set the Geometry CRS. For this data from iNaturalist it is EPSG:4326 - WGS84
- Click
Add
It’s often the case that spatial data comes in EPSG:4326 - WGS84, as that is the standard used by most GPS units and Google Maps. However, it’s still worth checking those details on the website you’ve downloaded it from. If your data doesn’t come with a predefined projection, and the spatial portal doesn’t specify, but it uses a Google Maps style interface, it’s probably using EPSG:4326 - WGS84.
Data Summary
You should have:
- From earlier:
- Turbine Locations
- Proposed Access Track
- Project Area
- BVG Data
- OpenStreetMap basemap
- Just imported:
- Animal Sightings
Analysis: Spatial Overlaps
Let’s find out what BVGs are in our Project Area, and the total area they take up. We’ve already clipped the BVG data to the size of our project area, now we just need to analyse it.
Dissolve the polygons together
Right-click on the AH BVG file and click Open Atrribute Table, you will see that there are many rows representing the separate polygons, even if they have the same BVG category (bvg1m). To calculate the area, it would be easier if we combined each polygon of the same BVG category.
- Go to Vector > Geoprocessing Tools > Dissolve…
- Select
EH BVGas the Input layer - Click
...next toDissolve field(s) - Tick
bvg1mand clickOK - Click
Run
If you look at the EH BVG Attribute Table now, you will see that they have now all been merged by bvg1m .
A quick way to see the difference between the two layers is to select both in the Layers panel, right-click and select “Show Feature Count”.
Field Calculator
We can use the Field Calculator to calculate the area of our polygons.
Select Dissovled from the Layers panel, and the click the Open Field Calculator button 
In the Field calculator window, type the following code into the Expression tab:
$area/10000$areawill give us the area of a single polygon (converted to hectares by dividing by 10000)- Below the text box, you will see a field titled Preview:, the value following that contains the results of our expression for one BVG category.
- We will use this to create a new field in our Attribute Table
- Next to
Output field nametype “area_ha” - Next to
Output field typechange it toDecimal Number (Real) - Click
OK
To find the percentage:
Open the Field calculator, and type the following code into the Expression tab:
("area_ha" / sum("area_ha")) * 100- This will divide the area for each category by the total area, and find the percentage
- Next to
Output field nametype “area_percent” - Next to
Output field typechange it toDecimal Number (Real) - Click
OK
If you look at the Dissolved Attribute Table now, you will see that there is now an area_ha and an area_percent column, these are very useful values for reporting.
Analysis: How many animal types are there in the project area?
Count Points in Polygons
Previously we looked at overlap between polygons, we can also look at points overlapping with a polygon. Let’s use the Count Points in Polygons tool to quickly count the number of animal species sighted inside the BVG types in our Project Area.
Let’s determine how many species are inside of each BVG.
Go to
Vector > Analysis Tools > Count Points in Polygons...In the Polygons field select
DissolvedIn the Points field select
animal_sightingsIn the Class field field select
scientific_name- Note that if we didn’t select anything here, it would simply count number of sightings (abundance) in the Project Area.
In the Count field name field type in something like
Species_RichnessClick the three dots
...next to the Count section, and click Save to File…Navigate to your processed folder and save the file as BVG_Species
Click
Run
If this tool is ever being really slow, we might be able to benefit from cancelling and using the the Fix Geometries tool on the point layer
This will create a new copy of our BVG data which has now been clipped, dissolved, area calculated, and now has a species richness count.
You can now look at the Attribute Table (F6) for this layer to see the number of species sightings per BVG in our project area. Let’s use this new data:
Click on the BVG_Species layer in the Layers panel
Open the Layer Styling Panel by pressing F7 (or fn + F7)
Change the Symbology from
Single SymboltoGraduatedSet the Value to
Species_RichnessChoose a Color ramp of your liking
Click
ClassifyYou might want to play with the Mode to get a feel for the data
Now we can quickly see which BVG has the greatest observed species richness
We can go further and use the Field Calculator to compare species richness to the area (ha), and create a new field with that information.
Click on the Field Calculator button

Under Create a new field set the Output field name to
richness_areaSet the Output field type to
Decimal number (real)(we need to choose this option to ensure that we have decimals in our output)In the
Expressiontab enter"Species_Richness" / "area_ha"Click OK
Now you can change the Value in Layer Styling to
richness_area- Click Classify again
We can now clearly see that the richness was being skewed by the area.
Map Digitisation
Now that we have a better idea of what the vegetation and animal locations look like, let’s add another wind turbine location.
You may often need to create your own points, lines, and polygons to add new points, digitising satellite data, or simply highlighting a particular area. Let’s add a new point and road to the non-remnant area just north of Turbine 6 (T06).
Go to
Layer > Create Layer > New GeoPackage Layer...Click the three dots
...next to the Database sectionNavigate to your
data > processedfolder and save the file as New_TurbineFrom Geometry type select
MultiPointMake sure the CRS is set to
EPSG:7856 - GDA2020 / MGA zone 56Leave the other fields blank for now and click
OK
We now have a brand new layer that we can add points to.
Select the new New_Turbine layer and then click the Toggle Editing pencil
from the top menu (or go to Layer > Toggle EdititngOn your keyboard, press
Ctrl + .(or click
Add Point Feature) to start adding a new pointClick in the non-remnant patch just north of T06
Leave the fid as
Autogenerateand clickOKTo save what you’ve done, click the Save Layer Edits button next to the Toggle Editing button
To finish editing your layer click the Toggle Editing button
You now know how to digitise a point, but the same steps apply for creating a polygon or a line layer. We created a new layer here, and you can also do the same steps to edit a pre-exisiting layer too.
The Vertex Tool
will allow you to move the location of points (or corners of polygons) that you have already created (you also need to click the Toggle Editing button for this tool)
Select the Proposed Access Track layer and then click the Toggle Editing pencil
from the top menu (or go to Layer > Toggle EdititngClick the Vertex Tool
to start editing an existing lineHover over the corner point north-west of T06
You will see a grey + appear, hover over that, and click when it turns red
A red dotted line will now appear between that corner point and your cursor.
Left clickto add the next point in the line.Continue adding points to the line until you click roughly on the
New_TurbinePoint you just added.Right clickto stop digitising and create your new line segment.To save what you’ve done, click the Save Layer Edits button next to the Toggle Editing button
To finish editing your layer click the Toggle Editing button
Up next we will explore what we can do with Projections.