Working with Terrain Data

Warnung

This tutorial is now obsolete. A new and updated version is available at Working with Terrain Data (QGIS3)

Terrain or elevation data is useful for many GIS Analysis and it is often used in maps. QGIS 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 contours, hillshade etc.

Aufgabenübersicht

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

Andere Fähigkeiten, die Sie erlernen

  • Searching and downloading freely available terrain data.

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

Daten besorgen

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, search for the place name Mt. Everest. Click on the result to select the location.

../_images/1277.png
  1. In the Data Sets tab, expand the Digital Elevation group, and check GMTED2010.

../_images/2185.png
  1. You can now skip to the Results tab and see the part of the dataset intersecting your search criteria. 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/3128.png
  1. Select the 30 ARC SEC option and click Select Download Option.

../_images/479.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]

Arbeitsablauf

  1. Open Layer ‣ Add Raster Layer and browse to the downloaded zip file.

../_images/573.png
  1. There are many different files generated from different algorithms. For this tutorial, we will use the file named 10n060e_20101117_gmted_mea300.tif.

../_images/670.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/769.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 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/867.png
  1. We will now crop the raster to this area of interest. Select the Clipper tool from Raster ‣ Extraction ‣ Clipper.

Bemerkung

The Raster menu in QGIS comes from a core plugin called GdalTools. If you do not see the Raster menu, enable the GdalTools plugin from Plugins ‣ Manage and install plugins ‣ Installed. See Verwenden von Erweiterungen for more details.

../_images/966.png
  1. In the Clipper window, name your output file as everest_gmted30.tif. Select the Clipping mode as Extent.

../_images/1074.png
  1. Keep the Clipper window open and switch to the main QGIS window. Hold your left mouse button and draw a rectangle covering the full canvas.

../_images/11112.png
  1. Now back in the Clipper window, you will see the coordinates auto-populated from your selection. Make sure the Load into canvas when finished option is checked, and click OK.

../_images/1278.png
  1. Once the process finishes, you will see a new layer loaded in QGIS. This layer covers only the area around Mt. Everest.Now we are ready to generate contours. Select the contour tool from Raster ‣ Extraction ‣ Contour.

../_images/1371.png
  1. In the Contour dialog, select everest_gmted30 as the Input file. Name the Output file for contour lines as everest_countours.shp. We will generate contour lines for 100m intervals, so put 100 as the Interval between contour lines. Also check the Attribute name option so elevation value will be recorded as attribute of each contour line. Click OK.

../_images/1468.png
  1. Once the processing is complete, you will see contour lines loaded into the canvas. Each line in this layer represents a particular elevation. All points along a countour line in the underlying raster would be at the same elevation. The closer the lines, the steeper the slope. Let’s inspect the contours a bit more. Right click on the contours layer and choose Open Attribute Table.

../_images/1563.png
  1. You will see that each line feature has an attribute named ELEV. This is the height in metres 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/1660.png
  1. Select the top row, and click on the Zoom to selection button.

../_images/1756.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/1853.png
  1. Now let us create a hillshade map from the raster. Select Raster ‣ Analysis ‣ DEM (Terrain Models).

../_images/1945.png
  1. In the DEM (Terrain Models) dialog, choose everest_gmted30 as the Input file. Name the Output file as everest_hillshade.tif. Choose Hillshade as the Mode. Leave all other options as is. Make sure the Load into canvas when finished option is checked, and click OK.

../_images/2040.png
  1. Once the process finishes, you will see yet another raster loaded into QGIS canvas. Since you maybe zoomed-in near the Mt.Everest region, right click on the everest_hillshade layer and choose Zoom to Layer Extent.

../_images/2186.png
  1. Now you will see the full extent of the hillshade raster.

../_images/2239.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 contours layer, select Save as...

../_images/2335.png
  1. Select Keyhole Markup Language [KML] as the Format. Name your output as contours.kml and click OK.

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

../_images/2531.png

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