# Working with Height data

&#x20;Elevation data is an important part of field mapping. &#x20;

Here, you will learn more about what you can do with Digital Elevation Models, contours and hillshades in QGIS. &#x20;

![Contours and Hillshades in action ](https://1859916809-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MW-CoufgyGZ3iU5q9S1%2F-MW3g2RxyTKe_mmryGk1%2F-MW3iy045RyPGcDJM70y%2Felevation.jpg?alt=media\&token=ac0a9272-28b5-4c58-8357-a7fb2ab9c612)

## Digital Elevation Models

Digital Elevation Models (DEMs) across Antarctic vary in spatial resolution and coverage.  Today, we'll be looking at the Reference Elevation Model of Antarctica (REMA), which is at 8m resolution. &#x20;

### Loading DEM tiles

As DEMs are generally large files, most providers allow uses to download a smaller section, or "tile."  &#x20;

![REMA tiles (source: Polar Geospatial Center)](https://1859916809-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MW-CoufgyGZ3iU5q9S1%2F-MW3g2RxyTKe_mmryGk1%2F-MW3us2ZEcAl7AyhkoIb%2Frema_pgc.jpg?alt=media\&token=884966b5-0e62-4bdb-a78d-8e40bc09961d)

Here, we're only looking at two tiles.  Please load the following files in to QGIS:&#x20;

* `39_11_8m_dem`
* `39_12_8m_dem`

It should look like this:&#x20;

![QGIS with REMA tiles](https://1859916809-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MW-CoufgyGZ3iU5q9S1%2F-MW3g2RxyTKe_mmryGk1%2F-MW3vphi5Ix68XF67wdY%2Frema_1.jpg?alt=media\&token=22cb131a-7120-4d2d-acae-e7feebc6c1cd)

Notice how QGIS zooms straight to your data?  Let's add a coastline file, so we know where we're looking at:

<div align="center"><img src="https://1859916809-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MW-CoufgyGZ3iU5q9S1%2F-MW3g2RxyTKe_mmryGk1%2F-MW3w3adQyn1c5wolBRh%2Frema_coasltine.jpg?alt=media&#x26;token=69d196f4-95f4-485d-ae73-2b97268074a4" alt="QGIS with REMA tiles and coastline"></div>

### Merging DEM Tiles:&#x20;

We have two tiles, but it would be good to have one larger one so we can perform some analysis.  Let's use the **Merge** tool for this:&#x20;

1. Go to the **Processing Toolbox** - either from the top menu, or at the side panel
2. Search "**Merge**"

![QGIS with the Processing Panel](https://1859916809-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MW-CoufgyGZ3iU5q9S1%2F-MW3g2RxyTKe_mmryGk1%2F-MW3x7skYwmL08M2Z9c-%2Frema_merge.jpg?alt=media\&token=ddcdf72a-50cf-495b-ad3b-a610db919977)

#### In the Merge Tool:&#x20;

1. Select your **DEM** files as the **Input**
2. Choose where to save your final product (leave this blank to make a temporary layer that will not be saved)

![Merge Tool](https://1859916809-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MW-CoufgyGZ3iU5q9S1%2F-MW3g2RxyTKe_mmryGk1%2F-MW3yhBwnOe7XY7YoFhD%2Fmerge_combine.png?alt=media\&token=a14b4691-1c8f-4d5a-bf41-8ed59a92a72c)

Now you have one DEM file!&#x20;

## Creating Virtual Rasters

Sometimes, you want to use multiple tiles without having to save a new file - this lets you save space on your PC/drive.  To create a virtual raster:&#x20;

1. Access the **Create Virtual Raster** tool by going to the **Raster toolbar ➤ Miscillaneous ➤ Build Virtual Raster**

![Accessing Create Virtual Raster from the Toolbar](https://1859916809-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MW-CoufgyGZ3iU5q9S1%2F-MkMNvFRU-MmZ3pQ0RIy%2F-MkMPf-8RGgRhpaeVZty%2Fvirtual_raster_1.jpg?alt=media\&token=0339ae07-f020-41e7-adb6-53444f3c16f7)

&#x20; 2\. Click the **`...`** button beside **Input Layers** and select the rasters you want to combine

&#x20; 3\. Choose "**Highest**" in the **Resolution** Drop-down

&#x20; 4\. Click **Run**

![Build Virtual Raster Tool](https://1859916809-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MW-CoufgyGZ3iU5q9S1%2F-MkMNvFRU-MmZ3pQ0RIy%2F-MkMRiAHY2xoBZVDg-eM%2Fvirtual_raster_2.jpg?alt=media\&token=a00b16f8-e6c7-44cf-8456-04f531ca58ba)

This will result in a new Virtual Raster, containing the tiles you have selected.  In this case, we have used the two REMA tiles from previously. &#x20;

{% hint style="success" %}
You can see which data is a Virtual Layer in the Layer Tree - it as a symbol beside the Layer Name - see what we mean below:&#x20;
{% endhint %}

![Layer Tree highlighting a Virtual Raster in the list](https://1859916809-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MW-CoufgyGZ3iU5q9S1%2F-MkMNvFRU-MmZ3pQ0RIy%2F-MkMSQFMC9AmNpg93E2p%2Fvirtual_raster_3.jpg?alt=media\&token=d13627e9-6cff-43ed-b565-d31079e974b4)

## Creating a Hillshade

Hillshades are a really useful way to visualise a DEM.  To create a hillshade:&#x20;

1. Access the Hillshade tool from **Raster ➤ Analysis ➤ Hillshade.**&#x20;

* 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

![The Hillshade tool with appropriate parameters](https://1859916809-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MW-CoufgyGZ3iU5q9S1%2F-MW48f9cjsBLp1VQ5DOB%2F-MW49Oj9y_f34KrCS4tU%2Fimage%20\(13\).png?alt=media\&token=205e9386-f3d0-41e4-9f08-60a206c1adc0)

2\. Click **Run**. This might take a minute or 2, and then your hillshade should appear in your Layers panel.

![Hillshade generated from the REMA mosaic](https://1859916809-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MW-CoufgyGZ3iU5q9S1%2F-MW48f9cjsBLp1VQ5DOB%2F-MW4B-4CwRDyUMazrnCF%2Frema_hillshade.jpg?alt=media\&token=8bb4ce13-3745-40cd-8c7c-c41bb18ff4ef)

## Creating Contours

Contour generation is pretty straightforward in QGIS, but there can be issues when there is missing data (such as in this example!)&#x20;

1. Go to the **Processing Toolbox**, and search for "Contour"
2. Select the Tool under **GDAL -> Raster Extraction**:

![Contour tool in the Processing Toolbox](https://1859916809-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MW-CoufgyGZ3iU5q9S1%2F-MW3g2RxyTKe_mmryGk1%2F-MW3zt0b80jZQ8tdU1bk%2Fcontour.png?alt=media\&token=1f1915bc-41ef-4922-b13a-8c29a4808afc)

Once you've selected the **Contour tool**:&#x20;

1. Select your **Merged DEM** as an **Input**
2. Choose where to save it (leave this blank to make a temporary layer that will not be saved)
3. Choose a **Contour Interval of 100**&#x20;

![Contour Tool](https://1859916809-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MW-CoufgyGZ3iU5q9S1%2F-MW3g2RxyTKe_mmryGk1%2F-MW403t0FLEbLTBMp0rj%2Fcontour1.png?alt=media\&token=55e22bbf-1d59-4146-abe2-9148113cfd69)

### Styling Contours

At the moment, your contours probably look like this:&#x20;

![Not very useful contours!](https://1859916809-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MW-CoufgyGZ3iU5q9S1%2F-MW3g2RxyTKe_mmryGk1%2F-MW43WPoEnEGH9hYLIEE%2Fcontour_style1.jpg?alt=media\&token=dc5dfcee-7089-48f9-aea7-47050fd2b2a4)

In order to make some sense, it's useful to Style contours using Index Contours.  This can be done in the **Properties -> Style Panel**.

We need to **Filter** the lines by whether they are a multiple of a number.  In this case, as the interval is 100m, a **500m Index contour** would be good. &#x20;

{% hint style="warning" %}
Contours provided by MAGIC will usually already have this step done for you.  Please ask MAGIC if you need any help!&#x20;
{% endhint %}

1. Open the **Symbology Tab** in the **Layer Properties** (double-click the layer name in TOC)&#x20;
2. Select "**Rule-based**" symbology
3. Double-click on the line symbol. It will open an **"Edit Rule"** box
   1. Name your Rule : "Index Contour"
   2. In Filter, type: `"ELEV" % 500 = 0`
   3. Style your line.  We generally use blue for the polar regions, and make the index line thicker than the normal contour. &#x20;

{% hint style="info" %}
**"ELEV"** is the **Attribute Field** in your **Contours** layer

**500** is your Index Contour **interval**
{% endhint %}

![Index Contour Styling](https://1859916809-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MW-CoufgyGZ3iU5q9S1%2F-MW44uNHCPGiNz3WdV9z%2F-MW46TPEay7kHvzRTd5U%2Fcontour_style2.png?alt=media\&token=f5ddbe60-00a0-42da-9df0-f4d5e5c6c81a)

Now you've got your index contours, done, you need a rule for the rest of the lines.  This is pretty straightforward:

1. Click the "+" symbol at the bottom of Rule Panel
2. Label the Rule "Contour"
3. Click "Else"&#x20;
4. Style as before, but make sure the line thickness is less than the index contour. &#x20;

![Adding a Contour Rule for the rest of the lines](https://1859916809-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MW-CoufgyGZ3iU5q9S1%2F-MW44uNHCPGiNz3WdV9z%2F-MW488D8nRwm_j6tCXrm%2Fcontour_style3.png?alt=media\&token=adbed1e1-d8fc-444e-b653-e1bc3cf67b5c)

You should now have something that looks like this!&#x20;

![Contour Styles](https://1859916809-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MW-CoufgyGZ3iU5q9S1%2F-MW44uNHCPGiNz3WdV9z%2F-MW48Twa-o8jj0vQa21F%2Fcontour_style4.jpg?alt=media\&token=0f23c166-8c56-4365-b10f-40d4a6f3f557)

### Labelling Contours

Labelling all the contours would make the map really cluttered.  We're going to Filter the labels, by only labelling the Index Contours.

1. Select the "Labels" tab in Layer Properties
2. Choose "Rule-based Labelling"
3. Create a Rule:&#x20;
   1. Name it "Index Contour Labels"
   2. Use the same filter as the Contours: **`"ELEV" % 500 = 0`**
   3. Select the field you use to label the lines - in this case, "ELEV"
   4. Style your label - make sure your Placement settings are **"Curved"** or **"Parallel"** and you have the **"On Line"** option ticked.  We also add a **Mask** so you can read the lines clearer.&#x20;

![Contour Labels Settings](https://1859916809-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MW-CoufgyGZ3iU5q9S1%2F-MW4B3twB6WwxbYX0_Qq%2F-MW4EW3rLqJMqg1UqITi%2Fcontour_labels1.jpg?alt=media\&token=8c2c3f2e-abfc-4862-b8c9-ff0f971d8a03)

Now you should have something like this:&#x20;

![Contours with Labels](https://1859916809-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MW-CoufgyGZ3iU5q9S1%2F-MW4B3twB6WwxbYX0_Qq%2F-MW4Eg6z5WV6Z4jpiQRh%2Fimage.png?alt=media\&token=f6b8e13d-2018-4219-a2eb-3a0b50f37416)
