Working with Terrain Data (QGIS3)

Terrain or elevation data is useful for many GIS analyses, and it is often used in maps. QGIS3 has good terrain processing capabilities built-in. In this tutorial, we will work through the steps to generate various products from elevation data such as hillshade and contour.

Overview of the task

The task is to create contours and a hillshade map for area around Mt. Everest.

Other skills you will learn

  • Searching and downloading freely available terrain data.

  • Exporting a vector layer as KML and viewing it in Google Earth.

  • Smoothing of contour lines.

Get the data

We will be working with GMTED2010 dataset from USGS. GMTED (Global Multi-resolution Terrain Elevation Data) is a global terrain dataset that is the newer version of GTOPO30 dataset.

Here is how to search and download the revelant data from USGS Earthexplorer.

  1. Go to the USGS Earthexplorer . In the Search Criteria tab, click on World Features. In Feature Name enter Everest, in Country enter NEPAL, click on Show. This will display a table with the location information. Select Everest under Placename.

../../_images/1169.png
  1. Now the canvas will move to Mt. Everest location. Click on Data Sets.

../../_images/2138.png
  1. Expand the Digital Elevation group, and check GMTED2010. Click on Results.

../../_images/377.png
  1. Click the Download Options button.

هشدار

You will have to log in to the site at this point. You can create a free account if you do not have one.

../../_images/447.png
  1. Select the 30 ARC SEC option and click Download.

../../_images/541.png

You will now have a file named GMTED2010N10E060_300.zip. Elevation data is distributed in various raster formats such as ASC, BIL, GeoTiff, etc. QGIS supports a wide variety of raster formats via the GDAL library. The GMTED data comes as GeoTiff files which are contained in this zip archive.

For convenience, you can download a copy of the data directly from below.

GMTED2010N10E060_300.zip

Data Source: [GMTED2010]

Procedure

  1. Open Layer ‣ Add Layer ‣ Add Raster Layer.

../../_images/640.png
  1. Click on the ... under Source, search and select the file named 10n060e_20101117_gmted_mea300.tif.

../../_images/740.png
  1. You will see the terrain data rendered in the QGIS Canvas. Each pixel in the terrain raster represents the average elevation in meters at that location. The dark pixels represent areas with low altitude and lighter pixels represent areas with high altitude.

../../_images/839.png
  1. Let's find our area of interest. From Wikipedia, we find that the coordinates for our area of interest - Mt. Everest - is located at the coordinates 27.9881° N, 86.9253° E. Note that QGIS uses the coordinates in (latitude, longitude) format when the CRS is set to EPSG:4326. Therefore, paste the value 27.9881, 86.9253 these at the bottom of the QGIS window where it says Coordinate and press guilabel:Enter. The viewport will be centered at this coordinate. To zoom in, Enter 1:1000000 in the Scale field and press Enter. You will see the viewport zoom to the area around the Himalayas.

../../_images/940.png
  1. We will now crop the raster to this area of interest. Search for Clip in Processing Toolbox. Select the Clip Raster by extent under GDAL algorithms.

../../_images/1047.png
  1. In the Clip Raster by Extent window, select 10n060e_20101117_gmted_mea300 as Input Layer, click ... in Clipping extent and select Use Map canvas extent, click ... in Clipped (extent) and enter the name as mt_everest.tif. Click Run.

../../_images/1170.png
  1. A new layer mt_everest will appear in the canvas. Search for Hill in Processing Toolbox. Select the Hillshade algorithm under GDAL algorithms.

../../_images/1250.png
  1. In the Hillshade window, select mt_everest as Elevation Layer, enter 315.000 in Azimuth (horizontal angle), enter 45.000 in Vertical angle. Click ... in Hillshade and enter the name as mt_everest_hillshade.tif. Click Run.

../../_images/1348.png
  1. A new layer mt_everest_hillshade will appear in the canvas.

../../_images/1444.png
  1. Search for Contour in Processing Toolbox. Select the Contour algorithm under GDAL algorithms.

../../_images/1538.png
  1. In the Contour window, select mt_everest as Input Layer, enter 250 in Interval between contour lines. Click ... in Contours and enter the name as mt_everest_contour.gpkg. Click Run.

../../_images/1636.png
  1. A new layer mt_everest_contour will appear in the canvas. Right-click on the layer and click Open Attribute Table.

../../_images/1735.png
  1. You will see that each line feature has an attribute named ELEV. This is the height in meters that each line represents. Click on the column header a couple of times to sort the values in descending order. Here you will find the line representing the highest elevation in our data, i.e. Mt. Everest.

../../_images/1830.png
  1. Select the top row, and click on the Zoom to selection button.

../../_images/1924.png
  1. Switch to the main QGIS window. You will see the selected contour line highlighted in yellow. This is the area of the highest elevation in our dataset.

../../_images/2022.png
  1. Search for Smooth in Processing Toolbox. Select the Smooth under Vector geometry.

../../_images/2139.png
  1. In the Smooth window, select mt_everest_contour as Input Layer, enter 5 in Iterations. Click Run.

هشدار

The smoothing algorithm works by adding extra vertices along the lines. As you increase the number of iterations, the number of vertices in the contour lines increase by a large amount. So be careful in using higher number of iterations. You can reduce the file size of the output by exporting it as a shapefile and simplifying the results using Mapshaper.

../../_images/2223.png
  1. A new layer Smoothed will appear in the canvas. This layer will have more smooth edges compared to the mt_everest_contour layer.

../../_images/2320.png
  1. You can also visualize your contour layer and verify your analysis by exporting the contours layer as KML and viewing it in Google Earth. Right click on the smoothed layer, select Export ‣ Save Feature As....

../../_images/2420.png
  1. Select Keyhole Markup Language [KML] as the Format. Click ... in File name and enter the name as contour_smoothed.kml. Click OK.

../../_images/2519.png
  1. Browse to the output file on your disk and double-click on it to open Google Earth Pro.

../../_images/2616.png

If you want to give feedback or share your experience with this tutorial, please comment below. (requires GitHub account)