Calculating distance to the sea ice edge in QGIS
Introduction
This exercise presents a method to calculate the distance from a point location to the sea ice edge, using QGIS.
The exercise will begin by outlining the input sea ice edge data source. It will also explain some fundamental set up considerations regarding projections and distance calculation before getting into the process itself.
The operations will be executed using the QGIS user interface.
Learning outcomes
GIS based functions
Awareness of projections and distance calculation
Geometry calculations on line features
Vector data re-projection
Datasets
Sea ice data products derived from remote sensing instruments
A set of sample point data representing sample point locations
Tools required
QGIS Desktop v3.x with GRASS GIS functions installed.
The datasets
Sea Ice edges
Download and unzip this dataset of the median sea ice edge for January, for the years 1981 - 2010:
This data was sourced from NSIDC Sea Ice Index, version 3. For further details, see https://doi.org/10.7265/N5K072F8.
Fetterer, F., Knowles, K., Meier, W. N., Savoie, M. & Windnagel, A. K. (2017). Sea Ice Index. (G02135, Version 3). [Data Set]. Boulder, Colorado USA. National Snow and Ice Data Center. https://doi.org/10.7265/N5K072F8. [Median sea ice extent polyline for January, 1981-2010]. Date Accessed 10-07-2024.
This data is derived from sea ice concentration data, with the edge being delineated where the sea ice concentration is at 15%. Sea ice concentration is derived using passive microwave radiometer data. Objects on the earths surface emit microwave radiation at relatively low energy levels. The structure of ice typically emits more microwave radiation than the surrounding liquid water in the sea. Therefore, microwave radiometers can be used to detect the presence of sea ice.
Sample point data
You will also need this .csv file of some point data in WGS84, latitude/longitude:
The exercise
Step 1: Open a new QGIS project and load in the datasets
Open a new QGIS project and drag and drop the median_extent_S_01_1981-2010_polyline_v3.0.shp
file into the project.
You will notice that in QGIS, the projection of the project will be set according to the first dataset you load in to a new project. In this case, the projection is NSIDC Sea Ice Polar Stereographic South, or EPSG:3412.
You may also want to download the latest coastline from the Antarctic Digital Database (ADD) to provide some context to you project, which can be downloaded via the ADD data catalogue.
If you drag and drop the coastline data in to the project as well, you should get something like this:
Next you need to add in the point dataset. This is in the form of a csv with two columns, one for latitude and one for longitude. The projection of the data is WGS84.
In order to add these to the QGIS project, find the Add delimited Text Layer icon on the left hand side of the interface. Alternatively, go to the Layer Menu and select Data Source Manager, then choose the option of Delimited text. The dialogue box allows you to select the csv file, check it assigns the correct columns to lat and lon, and that the projection matches that of the coordinates in the csv.
Step 2: Create lines representing the shortest distance between each point and the sea ice edge
For this step, we will need to use the v.distance tool, which is a GRASS GIS tool which comes bundled with QGIS. But first, a note on projections.
Re-projecting sample_points
sample_points
The sample_points
data we just imported is in WGS84, lat/lon. However, the sea ice edge data is on a cartesian projection, NSIDC Polar Stereographic South, with coordinates in metres away from the South Pole. Unfortunately, the v.distance tool will give very odd results if we do not make sure the sample_points
data is in the same projection as the sea ice edge data. We therefore need to re-project it.
To re-project vector data in QGIS, we can right click it in the layer menu and select Export. In the Export dialogue, we need to save the data as a shapefile or Geopackage, and change the output CRS (coordinate reference system) to EPSG 3412. The output dialogue should look like this:
This new layer, will be added to your project. We can now use it as an input to the v.distance tool.
Execute v.distance tool
Open the Processing tools pane, and search for 'v.distance'. Fill in the fields as shown here:
Run the tool, and you will get a new line layer output to your project, which will connect each point to the closet point in on the sea ice edge. The layer is called Distance
.
Step 3: calculate the length of the output lines
We now have a set of connecting lines. If we calculate the length of these lines, we'll have a distance form each point to the closest point on the sea ice edge.
For the sake of this exercise, we will calculate the distance on the ellipsoid. In QGIS, we can change how the software calculates distances in the Project Preferences.
There is more than one way to calculate distance in GIS. We can either calculate distance on the ellipsoid, or we can calculate it on a cartesian projection. For shorter distances, a cartesian based calculation will be fine, but we need to make sure in this case we are using an equal-distant projection. We can also calculate on the ellipsoid, which can be done for both shorter and longer distances, but should definitely be considered if we are calculating longer distances.
Set QGIS to calculate distances on the ellipsoid
In the Project menu, select Properties. In this dialogue window that appears, choose the General tab. Choose the WGS84
ellipsoid in the Ellipsoid drop-down menu under Measurements.
Now we are ready to calculate the lengths of the lines.
Use Field Calculator to extract the lengths of the lines
In QGIS, we can make use of the Field Calculator, which allows us to make calculations based on features, their attributes, and their geometries.
In GIS, vector data will always have an associated Attribute Table, which contains extra fields of information (columns) associated with each feature (rows).
To access the attribute table of our lines feature, right click on the layer in the layer menu and select Open Attribute Table.
The attribute table window will open. Locate and click the Field Calculator icon. This will open another window, allowing you to add a field to the table a populate it with the length of the lines. Fill in the Field Calculator as shown in the screenshot below and click OK:
Finally, click the Save Edits button in the Attribute Table Window, and Toggle off edit mode (the Pencil icon button).
We now have a set of lines with length calculated in metres on the ellipsoid saved in the attribute table of the data.
Summary
This tutorial has described how to access sea ice edge datasets, how to load these into QGIS, how to load csv data of points and how to calculate distances. It's also highlighted some projection considerations.
Last updated