In this tutorial I will show you how to create a Hillshaded topographic map in QGIS. We will be using Shuttle Radar Topography Mission (SRTM) data, a near global Digital Elevation Model (DEM) collected in February 2000 aboard NASA’s Space Shuttle Endeavour (mission STS-99). The mission used a X-Band mapping radar to measure the Earth’s topography, built in collaboration with the U.S. Jet Propulsion Laboratory, the U.S. National Imagery and Mapping Agency (now the National Geospatial-Intelligence Agency), and the German and Italian space agencies.
The raw radar data has been continuously processed and improved since it was first collected. Countless artefacts have been painstakingly removed and areas of missing data have been filled using alternate data sources. The version we will be using is the 1 Arc-Second Global SRTM dataset, an enhanced 30 meter resolution DEM that was released last year. It is a substantial improvement over the 3 Arc-Second / 90 meter SRTM data previously available for Ireland. SRTM elevation data can be downloaded from the United States Geological Survey’s EarthExplorer website.
When first loaded into QGIS (via Add Raster Layer), the DEM is displayed as a rather uninformative black and white image.
It is therefore necessary to apply a suitable colour ramp that accentuates topography. While it is possible to create your own colour ramp, or use one of the colour ramps provided by QGIS, superior colour ramps can be downloaded using Etienne Tourigny’s Color Ramp Manager (Plugins – Manage and Install Plugins). After the plugin is added to QGIS, go to the Plugins menu again and choose the Colour Ramp Manager.
In the window that pops up, choose the full opt-city package and click check for update. The plugin will then download the cpt-city library, a collection of over a hundred cartographic gradients (version 2.15). After the package downloads, quit the dialogue.
Back in QGIS, right click the DEM layer to bring up the Layer Properties dialogue. In the Style tab, change the render type from single band grey to single band pseudocolor. Then click new color ramp and new color ramp again, choose the cpt-city color ramp to bring up the cpt-city dialogue. Click topography and choose the sd-a colour ramp. While this is an excellent colour ramp, I find its colours are a bit too strong for my liking.
Still in the Layer Properties dialogue, change the min and max values to match your DEM’s lowest and highest elevations values and click classify, this applies the new colour ramp. Next, change the brightness to 30 and lower the contrast and saturation to -20. Click OK to apply the new style and quit the Layer Properties dialogue.
Next we need to create a Hillshade layer from the DEM, a 3D like visual representation of topographic relief. This is achieved via the menu Raster – Analysis – DEM (Terrain models). There is one small catch, the hillshading algorithm assumes the DEM’s horizontal units are in meters (they are decimal degrees). We need to enter a scale correction factor of 111120 (in the Scale ratio vert. units to horiz. box). Once that is all done, select an output path to save the generated hillshade and click OK. Generating a hillshade may take up to a minute depending on the size of your DEM.
After the hillshade is created, open its Layer properties dialogue. Change the min and max values to 125 and 255, increase its brightness to 45 and contrast to 20. Finally, switch the blending mode from normal to multiply. This allows the DEM beneath the hillshade to show though. Click OK to apply the new style.
If you followed these steps correctly you will have created a fine looking topographic map similar to the one below. It’s also possible to create contours but that’s a tutorial for another day.
There are two hillshading algorithms available in QGIS, one by Horne (1981) and another by Zevenbergen and Thorne (1987). Jones (1998) examined the quality of hillshading algorithms, he found the algorithm of Fleming and Hoer (1979) is slightly superior to Horne’s (1981) algorithm. Zevenbergen and Thorne’s (1987) algorithm is a derivation of Fleming and Hoer’s (1979) formula. QGIS uses Horne’s (1981) algorithm by default.
Horn, B.K., 1981. Hill shading and the reflectance map. Proceedings of the IEEE, 69, 14–47.
Jones, K.H., 1998. A comparison of algorithms used to compute hill slope as a property of the DEM [PDF]. Computers & Geosciences, 24, 315–323.
Pingback: What’s New In GIS And Biological Research: 6 April 2015 | GIS In Ecology
I really found this article very helpful. However I couldn’t get the cpt-city app to download the styles. It seems to generate an error in QGIS 2.8.
Is there an alternate way to download and install the colour gradients? Whilst my map looks good without them, they dont look as good as yours!
Sorry to hear that, I had no problem downloading the cpt-city colour ramps myself. Here’s the colour ramp I used:
It’s a small text file that defines the colours used. To add the ramp, right click the Topography layer to open its Layer Properties, then on the Style tab click the yellow folder icon (it’s directly above Color). Navigate to the text file and add the ramp. Hope that helps.
Pingback: Create great looking hillshaded maps in QGIS | Geo-How-To News
Thanks for the great tutorial! I didn’t have to install the plugin. It was already installed in the color ramps. One question though: Why do you have to change the scale ratio? When I do this the map looks really black without shades or hills.:P
The hillshade algorithm only works when the DEM’s horizontal distance units are in meters or feet. However, most DEMs e.g. SRTM, are in decimal degrees (WGS84). If so, you will need to convert decimal degrees to meters by using the 111120 scale ratio. But if your DEM in a projected coordinate reference system i.e. meters or feet as horizontal distance units, there no need to use the scale ratio.
It’s actually best to project anyway because the 111120 ratio is an approximation that is only valid towards the equator. If your area is big enough the ratio degree / metre will vary significantly.
From the reply from MarcelMan, it sounds like there is not one z-factor. I want to get this right as I am calculating slopes and want the slope values to be correct. How could I calculate the z-factor for a specific area I am working? For example I am using a dataset where “the spacing of the grid points is .75 arc seconds north/south”. Elevations are in meters.
Further if I use the DEM over a very large area (e.g., state/province scale) will there be a different z-factor for different parts of the DEM? If so, what projection would you suggest I convert to to avoid having to use z-factor conversion?
Greatly appreciate your help or that of your readers. Bbrhuft, thanks a ton for your effort in writing this article! 🙂 Tim
Pingback: Criar atrativos mapas topográficos de relevo sombreado no QGIS | ecojustus
Thanks for your efforts! However, at 2.10.1, Color Ramp Manager is not listed in the Manage and Install Plugins window. But Konan (above) says that “It was already installed in the color ramps”. Maybe that is what I’m facing, but I don’t understand what Konan means, and I can’t find the plugin in any menu. Can anyone help me find Color Ramp Manager? Thanks!
You have to turn on the experimental plugins from the plugin settings.
Hope it helped
Great tutorial!! Thanks
It maybe worth noting that the GDAL documentation only recommends the magic number 111120 for locations ‘close to’ the equator, otherwise, it recommends to project the DEM to a regular grid. Otherwise, I stand by my previous comment!
Great tutorial! what if I need the inverse process? Is it possible to extract a simple DEM from a hillshade? I don’t have the raw data from where the hillshade was created, I only have the hillshade available
What if i have to do the inverse process? Is it possible to generate a DEM starting from a hillshade? I only have a WMS hillshade file from LIDAR and I need to create a normal DEM from it cause I need the z values..how can I do it?
Hello, just wondering if it is possible to use these maps for an academic article or how I would go about getting permission? Many thanks.
Yes, you can use my maps from this blog post an academic article. The maps and text uses the Attribution-ShareAlike 3.0 Unsorted licence. Just attribute me as the creator of the maps. This is the same licence as Wikipedia.
this is really helpful, thank you!
Great tutorial, thank you for your effort. But I have a major problem – when I follow tutorial and apply (any) pseudocolor ramp, my DEM layer disappears. Any ideas?
Sorry to hear you’re having trouble with the tutorial. I don’t think I’ve run into a problem like that before. Could you just check that the layer hasn’t “moved” somewhere else, due to a projection problem. Right click the layer and choose “Zoom To Layer”. SRTM topography is in WGS84 (decimal degree) coordinates, choosing the wrong projection could put it at Null Island. It’s the only thing I can think of at the moment.
You are right. I was reprojecting ASTER GDEM to ETRS and something goes wrong in this way: If I leave it in WGS it works just fine. Thank you very much, this terrain looks great this way.
Pingback: City of Seattle Hillshade – (Geo)graphics
obrigado pela ajuda. tutorial muito util para fazer o relevo sombrado
Thank you for this great tutorial!
Thank it’s a great tutorial. I have a question. what is the best way to denoise the image?
This is great!!! thanks for taking the time to write the tutorial.
This was brilliant, thank you!