In this monthly series, I turn my attention to one of the most powerful software packages for raster processing available – the Geospatial Data Abstraction Library (GDAL) – and as an added bonus, it’s free! Each month, I focus on a different utility offered in GDAL, walking the reader through its applications and offering up a series of tips and illustrations so that you can emulate this process in your office and/or home. In this edition of WIG, I show our readers how to use GDAL to create a topographic roughness map from a raster digital elevation model (DEM).
GDAL is an open source software application that was launched in 1998 and has been updated multiple times since. While the current version of GDAL (i.e. version 1.9) can be downloaded from multiple locations, I find this site to be the most up-to-date and easy to navigate. I suggest downloading the stable version of the MSVC2010 build for either 32-bit or 64-bit PCs depending on which you have access to. You can also download GDAL as part of an easier to install program, FW Tools, but the version of GDAL included with this installer is usually not the most recent.
GDAL contains a wide array of utilities to help you process raster files. I find that GDAL is more stable and runs quicker than ArcGIS, ENVI and PCI for data production – although the toolkit is more limited than in these applications. GDAL does not rate high for user-friendly functionality as it is command line driven (i.e. words and text, not graphics and mouse clicks); and this is the inspiration for creating the WIG series.
What is a Topographic Roughness Map?
A topographic roughness map is another function included in the GDAL DEM package that tries to assess how flat or steep a surface is in a numerical-fashion. Roughness is computed by subtracting the minimum elevation from the maximum elevation value in a defined-neighborhood around a central pixel. In GDAL, the neighborhood is fixed as the 8 nearest cells to a central pixel – which is an unfortunate lapse in the program. Roughness then is equal to the maximum elevation displacement in a three by three grid of DEM cells around a central point.
Given how roughness is calculated, it is always greater than or equal to zero. Values of zero or those close to zero indicate flat areas. While larger roughness values indicate increasingly steep terrain. Also note that similar to other measures of steepness, roughness is a scale-dependent index. First, you can vary the scale of the calculation itself by decreasing/increasing the size of the neighborhood (outside of GDAL of course) so that as you decrease the size of the neighborhood, finer and finer variations in the landscape are revealed. Second, the resolution of the DEM itself will impact roughness. For example, imagine a valley bottom in a 10-meter DEM and in a 1-meter DEM. In the 10-meter DEM, the valley bottom appears nearly flat; while in the 1-meter DEM, the valley is as an undulating surface with lots of local variability in elevation.
Creating a Topographic Roughness Map
In order to create a roughness map from a DEM, I employed the GDALDEM functions – you can find out more about them here. Here are the steps I took to create this layer:
- I moved my DEM file, a digital terrain model (DTM) produced by DigitalGlobe with 2-meter resolution over Gadara, India, to a folder called, ‘Test,’ located the root of my C: Drive
- This is the same data used in last month’s edition of WIG
- I chose a simple folder name and file location (i.e. C:test) for the data to make things easier when working with the command line interface of GDAL
- I also changed the name of the DTM file to ‘DTM.tif’ to make things easier when working with GDAL
- After starting up GDAL, I used the command: cdtest
- This command points GDAL to the folder I created with the DTM
- If you would like to get a list of the files in the folder you are working in, use this command: dir
- To calculate TPI, I used the following command: gdaldem roughness DTM.tif roughness.tif
- In this command, the words ‘gdaldem TPI’ define the utility that GDAL uses to process the data
- ‘DTM.tif’ is the full name of the input (original) DEM file
- ‘roughness.tif’ is the name I chose for the output topographic position map as a TIFF file; you can change the file extension ending to any in this list if you would prefer an alternate raster format
- 6. There are several universal GDAL GDEM functionality commands that can be added to a roughness calculation though none of them are specific to this command
Working With Roughness Maps in ArcGIS
In this, our final function of the GDAL GDEM series, it should be no surprise to regular readers that interpreting a roughness map in ArcGIS is not as upfront as one would like. The key challenge is to exclude the erroneous roughness values created at the edges of the map where no data exists; and then to create a colored symbology that is easy to interpret.
In each of the previous editions of WIG, I have included a thorough discussion of determining the maximum and minimum range for GDAL created datasets, so I will not reiterate the process here (see our October WIG edition for a complete handling of the steps). One reminder I will offer is that you may need to increase the number of pixels ArcGIS will compute values for in order to determine your max and min, this can be done under ArcMap Options->Raster Options.
After working through the steps to determine the maximum and minimum roughness values in my DEM, I found that the maximum value is 5.742 with a minimum of 0 – which is also be found in the no-data band at the edges. I created two colored versions of the roughness map – one with a continuous color scheme and one with color classes. To create the continuous color ramp, right-click on the roughness map and select Properties->Symbology. Select the Stretched option from the left-hand column and set the ‘Statistics’ to “From Current Display Extent” (this is located towards the bottom of the popup screen). I chose a continuous color ramp where yellow was the flattest and red the roughest areas. By setting the statistics to the current display extent, you can zoom around the roughness map and the colors will automatically scale to the roughness values you can currently see. This creates some very useful maps to identify small topographic features such as ridges and paths.
I created another colored roughness map using the Classified option under the Symbology tab. In order to do this, I first set the Exclusions under the Classify.. button to ‘5.742 – 33000’. Then I experimented with different classification schemes, settling on Standard Deviations with 5 classes. I chose Standard Deviations as this shows the data in increasingly rough classes according to their distance (so to speak) from the mean value of the roughness layer. I chose a Green-Yellow-Red color ramp to display the five classes with green being the flattest and red the roughest areas. In the animation below, you will see how this classified roughness map reveals more macro topographic features as opposed to the fine features the stretched map revealed.
Click the image above to see an animation of the two roughness maps created here as well as a comparison of these maps to high resolution natural color imagery. In this animation, you will see how each of the colored roughness maps reveal features of different scales. The imagery shows that forests are often located in rougher areas while humans inhabit those that are flatter. (DTM Source: DigitalGlobe)
Brock Adam McCarty