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. This data can be downloaded from the USGS Earthexplorer site. 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/1144.png
  1. Now the canvas will move to Mt. Everest location. Click on Data Sets.

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

../../_images/355.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/434.png
  1. Select the 30 ARC SEC option and click Download.

../../_images/534.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/633.png
  1. Click on the under Source, search and select the file named 10n060e_20101117_gmted_mea300.tif.

../../_images/733.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/832.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 (X, Y) format, so you must use the coordinates as (Longitude, Latitude). Paste 86.9253,27.9881 these at the bottom of the QGIS window where it says Coordinate and press 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/933.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/1032.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/1145.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/1235.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/1334.png
  1. A new layer mt_everest_hillshade will appear in the canvas.

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

../../_images/1531.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.gkpg. Click Run.

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

../../_images/1727.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/1824.png
  1. Select the top row, and click on the Zoom to selection button.

../../_images/1921.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/2016.png
  1. Search for Smooth in Processing Toolbox. Select the Smooth under Vector geometry.

../../_images/2121.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/2219.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/2316.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/2415.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/2514.png
  1. Browse to the output file on your disk and double-click on it to open Google Earth Pro.

../../_images/2612.png
comments powered by Disqus