Working with DEMs
Last updated
Last updated
In this section, we are going to work with a Digital Elevation Model (DEM) covering a section of Antarctica, and then create a hillshade and contours from the DEM.
The dataset you're going to be working with is part of the Reference Elevation Model of Antarctica v2.0 (REMA v2.0) - a DEM released by the Polar Geospatial Center (PGC) in the US, covering the majority of Antarctica at 2m spatial resolution. More information about REMA can be found on the PGC website, here.
The release of REMA v2.0 in October 2022 was an improvement on the first release of the dataset. REMA v2.0 provides DEM tiled mosaics of the entire continent of Antarctica, at 2m, 10m and 32m. Lower spatial resolution datasets are also available as single GeoTiffs, at 100m, 500m and 1km.
For this exercise, we will use a DEM contained in your data folder (called 40_08_10m_v2.0_dem.tif
- covering Rothera Point region). This is a 10m resolution tile. 2m resolution is also available.
If you wish to download your own tile, or the 2m version, please see the instructions at the end of this exercise.
Open a new, blank QGIS project (Project ➤ New) and add your 40_08_10m_v2.0_dem.tif
file into your empty project, either by dragging and dropping from your file explorer, or through one of the methods taught previously.
Save your project with a different name to your original project.
The image below shows roughly what your new project should look like, but with a different tile. You can already see roughly what this data is showing - QGIS automatically displays the raster 'stretching' between black for the low elevation and white for the high elevation. You can also see in the bottom right-hand corner that your project has been set to EPSG:3031. This is the CRS of the REMA data, and therefore your project automatically takes the CRS of the first file added.
Raster symbology can be a little bit complicated, but you are able to display your data in many different ways and it is worth looking into, if you use rasters very often. We will just cover a few points here.
Your data is currently displayed using a 'Render type' of 'Singleband gray'. Open up the Layer properties and Symbology tab to see this. This basically means that the data is displayed between a gradient of black to white, or white to black. Have a quick look through some of the settings in the Symbology tab for 'Singleband gray', but we will not edit any of these right now.
We will display the data in 2 different ways for now:
Under the 'Render type', change the selection to 'Hillshade'. Click Apply. A hillshade is a grayscale 3D representation of the surface, which takes the sun's position and the slope and aspect into account. They can be very useful backdrops for maps.
There are a few settings that can be adjusted - for now, change the azimuth and the Z factor and see what changes in your data. The azimuth is the direction of the light source and the Z factor defines the scaling or exaggeration factor.
We generally do not want to change the azimuth for a standard display, so put this back to the default of 315°. Some kind of vertical exaggeration can be useful though, so put this as 3 or 4 if it looks good for your area.
Next we are going to display the DEM as contours. (Note: this option is only available on QGIS 3.16 or later - move onto the next section if you are using an earlier version and cannot see the contour option)
Add another copy of the40_08_10m_v2.0_dem.tif
file into to your project (you can have multiple versions of the same dataset in your project)
Open the symbology and choose 'Contours' under the 'Render type' this time
Adjust the Contour interval and Contour symbol to suit your area. Give the interval contours a slightly thicker symbol.
This way of symbolising data can be really handy for a quick visualisation, or to test how the different parameters effect the output.
Although it is really useful to be able to display your DEM as we have done so above, this hasn't actually created a contour dataset or a hillshade that you could save for another project, or send to someone else, for example. To do that, we will run a couple of tools.
First, we will create a hillshade.
Access the Hillshade tool from Raster ➤ Analysis ➤ Hillshade.
Most of the parameters will not need to be changed
Alter the Z factor as required
Make sure you save the file somewhere (in the box where it says [Save to a temporary file] - click the ...
to the right of the box, and select 'Save to File')
It should default to .tif
format which is good for this use
2. Click Run. This might take a minute or 2, and then your hillshade should appear in your Layers panel. This is now a new geotiff that you could re-use and load into other projects.
3. We will now create contours. Access the tool from Raster ➤ Extraction ➤ Contour
Make sure the Input layer is your DEM and not your new hillshade
Set the interval to the value that you decided was most appropriate when visualising them before
Save the file the same way as you did for the hillshade - you can choose the format during this. I have chosen a GeoPackage in the screenshot below.
4. Click run. Again, this might take a minute, and then your new contours should appear in your map.
If you have time, there is one more task in this section, but do not worry if you don't have time for this
Sometimes, you might make contours at a certain interval but then decide you want to select those lines that are at a different interval. It is possible in QGIS to select these lines and then export them as a separate file (this selection feature has many very useful applications which is why we are teaching it here).
Open the attribute table of your contours (right click on the layer, Open Attribute Table)
Click on the 'Select features using an expression' button along the top of the attribute table, highlighted below. A new dialog box will appear
Complete the Expression with ("ELEVATION" % 500)=0
"ELEVATION" here is what I named my contour field - if you named yours differently then please adjust.
This expression is to select lines at 500 m intervals, if you would like to select different intervals then again, change the number.
There might well be other expressions that would create the same selection
4. Click 'Select Features'. You should now be able to see that some rows in your attribute table are selected, as well as seeing the lines selected on your map, highlighted in a different colour.
We will now export and save these selected lines as a new file:
5. Close the 'Select by Expression' panel and the Attribute table. Right click on your contour file in the Layers panel and select Export ➤ Save Feature As.
6. Select the location and name for your new file. Ensure that you tick 'Save only selected features' as shown below and select OK.
You should now have a new contour dataset in your map, with just the selected lines!
This is the end of this exercise and the information below let's you know how to download your own tile of REMA data for future use.
REMA v2.0 is available via AWS, at the link below:
It is also possible to download a polygon tile index file, and load that in to QGIS. This is really useful to determine which tile you might need.
Go to the REMA homepage and scroll down to the REMA Mosaic section.
On the right side of the page, you will see a link to download a Mosaic DEM extent index. Choose either the shp
, or gpkg
option. Unzip this download and load either the 2m, 10m, or 32m index file to your QGIS project, according to what resolution DEM you want.
Use the identify tool to query a tile. This will bring up the attribute information for the tile, which includes a download link (s3url
). You can use this link directly to download the tile.
Information source:
https://docs.qgis.org/3.16/en/docs/user_manual/working_with_raster/raster_properties.html