|Quantum GIS (QGIS) Raster Based Terrain Analysis Techniques|
This intermediate Quantum GIS (QGIS) tutorial will illustrate the 4 types of raster based terrain analysis techniques: slope, aspect, ruggedness index and total curvature. This tutorial will also demonstrate how to produce a shaded relief using QGIS. Users will be provided with 3D digital elevation model (DEM) raster data which can accurately store the x, y and z coordinate values for every location within the raster. Users will learn how to use the Raster Based Terrain Analysis plugin provided with QGIS, and also gain a clear understanding of the theory and process involved with these techniques.
To start off, download the sample DEM raster data here. Save the data to a known location on your system and extract it. Once the data has been extracted, open up Quantum GIS and select Layer > Add Raster Layer and open dem.tif. When the DEM is first loaded into QGIS it may appear as an entirely black square with some slight grayish colors showing up in some locations. This can be fixed by adjusting the stretch of the contrast enhancement to scale the shades of black and white to the values found within the data. To adjust the contrast enhancement, right click the DEM and select properties. In the bottom right hand corner of the Symbology section, change the Current value of Contrast Enhancement from ‘No Stretch’ to ‘Stretch to MinMax’. This takes the minimum (149) and maximum (2647) value found within the data, and stretches the black to white gradient between the two values. A typical black to white gradient allows for 256 different levels of brightness, and stretching these 256 shades between the Min and Max values allows you to clearly view the different topography in the DEM data. To keep this setting for all raster layers, simply click the save icon next to it to set it as the default value. Finally click Apply and Ok to improve the contrast of the DEM.
Picture 1 – View of original DEM data with contrast enhancement
Taking a look at the DEM data you can see that there is a wide variation of pixel brightness values across the grid area, with dark black pixels representing areas of low elevation and bright white pixels representing areas of high elevation. Use the identify features tool and click around within the DEM to find out the elevation value at that location, try clicking on different shades of brightness to sample all the different elevations.
QGIS Raster Based Terrain Analysis
Now that you are familiar with your DEM, it is time to begin the raster based terrain analysis techniques. In QGIS select Plugins > Raster based terrain analysis > Raster based terrain analysis. Note: If you do not see Raster based terrain analysis in your list of Plugins, select Plugins > Manage Plugins. Scroll down in the list until you find the Raster based terrain analysis, make sure there is a check next to that item, select ok.
Picture 2 – Raster based terrain analysis tool
This picture shows the QGIS raster based terrain analysis tool menu which is a fairly straight forward tool which allows you to perform the 4 types of raster based terrain analysis techniques: slope, aspect, ruggedness index and total curvature. These tools are used to calculate first and second order derivatives on a 3 x 3 cell grid, providing a calculation for each cell location in the raster based off of the 8 neighboring cells surrounding the location.
QGIS Slope Analysis
To start off, we will calculate the Slope of our DEM data. Select Slope from the Analysis drop-down, keep Input Layer set to dem. Click the browse button next to Output Layer, navigate to the same folder as your DEM data and call the output ‘slope’. Leave Output format set to GeoTIFF and check Add result to project, click Ok.
Picture 3 – Slope Analyis
Take a look at the output results of the Slope analysis, again make sure to use the identify features tool to explore the pixel values of light and dark areas. Slope is calculated with the first order derivative of the elevation at a location, to determine the steepness relative to the 8 surrounding pixel values. Right click the Slope layer and select Properties. As you can see the minimum and maximum values for the Slope analysis are very different to the original DEM. The units of the slope analysis have been measured in degrees of inclination, with a minimum value of 0 degrees and a maximum value of 68.132 degrees. Scroll down along the left hand side and select Histogram to view the frequency and distribution of the different values. The histogram shows that there is an abundance of relatively flat areas, but there is also a steady increase in frequency for the higher angles of degree within the data. Therefore you can use this Slope analysis to determine that this DEM contains mountainous areas, where the dark pixel values represent the relatively flat bottom of the valley and the bright pixels represent the steep peaks of the mountain tops.
QGIS Aspect Analysis
Next we will calculate the Aspect or direction of facing for the DEM data. Again select Plugins > Raster based terrain analysis > Raster based terrain analysis. Select Aspect from the Analysis drop-down, set Input Layer to dem. Click the browse button next to Output Layer and enter ‘aspect’ for the output name. Again keep the Output format set to GeoTIFF and make sure that Add result to project has a check, click Ok.
Picture 4 – Aspect Analysis
Exploring the brightness values of the aspect layer will show that this analysis also has a very different range of values compared to the original DEM and our Slope layers. Using the layer properties you can see that the minimum and maximum range from around 0 – 360. The aspect units are expressed in terms of degrees of cardinal direction co-related to the direction a hillside is facing. This scale starts with 0 degrees as North, and continues in a counter-clockwise direction all the way to 360 degrees. Use the image below as a reference to the degree values of cardinal direction.
Picture 5 – Aspect Key
Using the legend you can determine the appropriate aspect for each hillside in the area, allowing you to identify North (~ 0 or 360 degrees), South (~ 180 degrees), East (~270 degrees) or West (~90 degrees) facing hillsides. Values found in between these ranges assume a mixture of cardinal direction, ex. 225 degrees would represent a hillside with a South-East facing aspect.
QGIS Ruggedness Index Analysis
The next technique we will discuss is the Ruggedness Index analysis. The ruggedness index value is calculated for every location, by summarizing the change in elevation within the 3x3 pixel grid. The ruggedness index is used as a measurement of terrain heterogeneity as described by Riley et al. (1999).
Ruggedness index values have been classified into categories to describe the different types of terrain. The classifications are as follows:
To calculate the ruggedness index values for our DEM, select Plugins > Raster based terrain analysis > Raster based terrain analysis. Set the Analysis drop-down to Ruggedness Index, select dem as the Input Layer. Click the browse next to Output Layer, navigate to the location of your dem and call the file ruggedness_index. Leave the Output format set to GeoTIFF and make sure there is a check next to Add result to project, click Ok.
Picture 6 – Ruggedness Index Analysis
At first glance it seems that the calculation for ruggedness index is identical to the slope calculation. However, upon further inspection you will note that the minimum and maximum value range is different indicating that different units have been used. The ruggedness index value uses meters as the measurement unit. Right click the Ruggedness index layer and select properties to view the min and max values. Inspecting the results shows that the maximum value of 182.173m is classified as Intermediately rugged according to the classification system above. Scroll down on the left hand side once again to view the Histogram. The histogram shows that the majority of the data falls into the Level classification, but a fair amount of locations exhibit some of the higher classification ranges. These areas of ruggedness are likely found around the peaks of the highest mountains and in areas with large cliffs, where changes in elevation are more dramatic.
QGIS Total Curvature Analysis
The last analysis technique offered by the QGIS Raster based terrain analysis is the calculation of Total curvature. The calculation of curvature uses the second order derivative for the 3x3 grid of pixels. In theory this is calculating the slope of the slope for every location, where negative values indicate that the surface is upwardly concave at that location, and conversely positive values indicate that the surface is upwardly convex. Values of 0 indicate areas where the surface is flat and no curvature exists. Calculation of total curvature is also possible within ESRI tools, for a greater understanding of the calculation and process involved I suggest you read the ESRI documentation.
To calculate the total curvature of the DEM within Quantum GIS, open up the Raster based terrain analysis tool once again. Select Total curvature from the Analysis drop-down, select dem as the Input layer. Again click the browse button next to Output layer, navigate to the location of your DEM and save the file as total_curvature. Leave the Output format set to GeoTIFF and place a check next to Add result to project, click Ok.
Picture 7 – Total Curvature Analysis
When first looking at the results it is hard to distinguish very many features and the area of the DEM appears to be mostly black. Right click the Total curvature layer and select properties to view the minimum and maximum values. As you can see the reason why everything appears to be so dark is because we have a minimum value of 0 and a maximum value of 0.00199637. The fact that the minimum value is 0 indicates that no negative values were found within the DEM area. Therefore there are no surfaces that are upwardly concave, and only surfaces with upwardly convex form were found. The areas with the highest values appear to be located along the boundaries of steep cliff faces. This concludes the analysis techniques offered through the QGIS Raster based terrain analysis tool.
QGIS Shaded Relief
The final technique we will discuss in this tutorial describes how to produce a shaded relief within Quantum GIS. Shaded relief can be used to calculate the amount of sun or shade for a 3D surface. Unfortunately this plugin is not offered directly with QGIS and it must be added and installed. Follow the instructions below to install the Shaded Relief plugin for Quantum GIS.
You should now see the Shaded Relief plugin under your Plugins menu item in Quantum GIS. Turn off all layers in your project, and make sure to place a check next to your DEM layer only and select your DEM layer so that it is highlighted. Open up the tool by selecting Plugins > Shaded Relief > Shaded Relief. Keep all the settings set as default and click Ok. Navigate to the location of your DEM and call this file shaded_relief. Once the new layer appears you can close the Shaded Relief tool.
Picture 8 – Shaded Relief
Looking at the shaded relief results provides the most visually appealing display of the 3D DEM data. This analysis uses a fixed location of the sun and the horizon to accurately display areas of bright sun exposure as well as low dark areas that contain lots of shadow. Typically a shaded relief will be used in presentation of 3D GIS analyses as a thematic background layer that provides the user with pretty looking cartographic representation.