Area calculation in QGIS
Last updated
Last updated
Amidst the Coronavirus twists and turns reported in the news of late 2020, the journey of A68 Iceberg became a firm topic of conversation among the polar community and wider public.
Since calving from Antarctica's Larsen C ice shelf in July 2017, the berg had been drifting slowly northwards. Once it was within striking distance of South Georgia, the speculation began. Would it cause environmental damage to the remote island's biodiversity? Would it ground off the coast and hang around for a few more years? Would it drift by and break up?
And, how big is it anyway?
This tutorial will explain how to perform an area calculation in QGIS, using a digitised polygon of A68 iceberg as an example.
Awareness of coordinate reference system considerations when calculating areas
Geometry calculations of vector polygons in QGIS using Field Calculator
QGIS Desktop v3.x. We recommend using the current Long Term Release version.
We will be using a dataset of vector polygons defining the size, shape and position of the iceberg through time (iceberg_a68.gpkg
). This has been produced by Laura Gerrish, Mapping Team, BAS. You can download this below:
It is also recommended to download the latest coastline of South Georgia https://www.sggis.gov.gs/ to provide context.
The coordinate reference system of both the iceberg polygons and the ADD coastline is WGS84 / South Georgia Lambert (EPSG:3762).
Open QGIS
Drag and drop the two datasets into the project. You will first have to unzip both iceberg_a68.zip
and the coastline (download if you obtained it).
Zoom to the extent of the layer iceberg_a68
You will notice the coordinate reference system (CRS) of the QGIS project has been set to WGS84 / South Georgia Lambert (EPSG:3762). This is because QGIS will set it's project CRS to match that of the first dataset that is loaded into a new project.
iceberg_a68
layerNow is a good time to have a closer look at the iceberg polygon data.
Select the Identify Features tool.
Click on any of the iceberg polygons to reveal the attribute information associated with each polygon.
Right click on the iceberg_a68
layer in the layer menu and select Open Attribute Table to view the date of each polygon and imagery source for each polygon in table form.
As mentioned, the coordinate reference system (CRS) of the iceberg_a68
layer is WGS84 / South Georgia Lambert. This projection is not an equal area projection, therefore if we calculate the area of the polygons using this CRS, the numbers will not be accurate.
We can re-project the data to a CRS that will preserve areas. As the iceberg is relatively, this method should provide us with accurate results
However, we can also calculate areas on the ellipsoid, which involved more complicated mathematics, but we can also be sure it will provide accurate results, no matter how large an area we are calculated over.
In the Project menu, select Properties. In the dialogue window that appears, choose the General tab. Choose the WGS84
ellipsoid in the Ellipsoid drop-down menu under Measurements.
Notice the units are in square metres for area. We can change this to suit the purpose.
To calculate the area of each individual polygon, we will first open the Attribute Table, and use the Field Calculator to extract the area geometry of each feature to a new field in the table.
Step 3 above demonstrates a good way to calculate areas in QGIS. This is a good method for making sure we get accurate area calculations.
However, it is just as valid to calculate areas using a planimetric calculation, if the map projection we are using is suitable, ie. it is an equal area projection.
As stated above, the CRS of the iceberg_a68
layer is not an equal area projection. As such there are a few steps we need to take before we can re-do the area calculation using the Field Calculator.
Re-project the data to an equal area projection
Change the QGIS project properties to calculate using the datasets CRS, rather than the ellipsoid
Re-run the field calculator process
iceberg_a68
to an equal area projectionRight click on the layer in the layer menu and choose Export > Save Features As.
Choose output format at Geopackage
Change the CRS to EPSG:102020 South Pole Lambert Azimuthal Equal Area.
Save the dataset.
The dataset will appear automatically in your QGIS project. You can confirm the projection of the dataset by right clicking on the layer and selecting Properties.
In the Project menu, select Properties. In the dialogue window that appears, choose the General tab. Choose the None / Panimetric
option in the Ellipsoid drop-down menu under Measurements.
This will ensure QGIS uses the coordinate reference system of the dataset when it performs geometry calculations in Field Calculator.
The result of this will show very similar measurements for area.
We can calculate the difference between the two measurements using the field calculator.
Open the Field Calculator, choose to create a new column called 'diff' with a decimal number data type. In the Expression box, type:
"area" - "area_eq"
And click Ok. Your resulting table should look like this. The area differences are within 2 square metres.
This tutorial has provided a dataset of the locations of the A68 iceberg as it moved towards South Georgia at the end of 2020.
It has shown how to calculate the area of the each iceberg polygon in QGIS using an ellipsoid based calculation.
It has also demonstrated area calculation using an equal area projection using QGIS.
Remember that in QGIS, the Field Calculator geometry calculation will use calculate the area based on the CRS of the dataset, regardless of what CRS the project is in.
Also remember that you can check whether it is calculating on the CRS of the dataset, or on an ellipsoid model, by querying the project properties dialogue box.