12

I used an SRTM DEM to create a hillshade in QGIS 2.2.0. However, the resultant hillshade seems to be vertically exaggerated. Also, changing the settings for scale and z-factor does not have any effect on the resultant hillshade. I have tried both options in QGIS, Analysis-> DEM (Terrain models) and Terrain analysis -> Hillshade. Both methods gave the same results.

Is this an isolated incident, a bug, or am I missing something?

3
  • 4
    When you are using a DEM with latlon coordinates in decimal degrees and vertical units in meters you have to set the scale (ratio of vertical units to horizontal units) to 111120. I tried with a couple of DEMs from Aster I have not a problem. This setting aplies not only to hillshading but also for slope calculations. Hope it helps Commented May 8, 2014 at 13:22
  • @GerardoJimenez, I've tried it and it worked. Thanks
    – PyMapr
    Commented May 8, 2014 at 13:29
  • @GerardoJimenez, Thanderbolt either of you should submit and answer for this question and Thunderbolt should accept it to remove this question from unanswered. Commented May 8, 2014 at 13:54

2 Answers 2

17

@Gerardo's answer is only correct at the equator. The gdaldem doc notes those scale values are for "LatLong projections near the equator"

To calculate the scale or Z factor (inverse of scale) at other latitudes for a dem with vertical units in metres, you can use the following equations:

s=111320*cos(latitude*pi/180)
z=1/(111320*cos(latitude*pi/180))

where: 111320 is the length of one degree at the equator in metres (based on WGS84, you can use 111111 if that's easier to remember, or you have an appreciation of history) and latitude is the latitude at the centre of your DEM.

You can quickly calculate the scale/z factor in Excel/Libre Office Calc with the following formulas:

For -s scale parameter
=111320*COS(latitude*PI()/180)
or
=111320*COS(RADIANS(latitude))

For -z z factor parameter
=1/(111320*COS(latitude*PI()/180)
or
=1/(111320*COS(RADIANS(latitude))

You can even use a simple Google search:

111320 * cos(latitude deg)
or
1/(111320 * cos(latitude deg))

E.g. scale and z factor for Latitude = 38.5S

For DEMs with vertical units in feet, just convert the length of one degree at the equator in metres to feet, i.e 3.28 * 111320 = 365130. So your equations become:

s=365130*cos(latitude*pi/180)
z=1/(365130*cos(latitude*pi/180))

Alternatively, you can reproject your DEM to a projected coordinated system (also suggested by the gdaldem docs).

3
  • This answer really helped me today but I am a bit confused about the terms used in QGIS. When I go to Raster - Terrain Analysis - Slope I get the field named "Z factor" but here I have to enter the value that is termed "scale" here and not the inverse value which is termed "Z factor" here. You cant enter the very small number I get when calculating the inverse with above calculation and the default value already tells you that it has to be a large number but its still a bit confusing because I thought both term "scale" versus "z factor" couldn't be used synonymously.
    – Taya
    Commented Apr 18, 2016 at 9:30
  • @Taya I don't see a "Z Factor" field in the Raster->Analysis->DEM (Terrain Models) tool from the menu in in QGIS 2.14. I only see a Scale field. Perhaps it was a bug in earlier versions of QGIS...? Edit: Ahh, you're using the terrain analysis plugin, that must be a bug in the plugin.
    – user2856
    Commented Apr 18, 2016 at 23:09
  • I would suggest a couple of changes to this answer: 1. For most applications you would use either the scale factor s or the z factor, not both (s seems like a more logical choice and works better in QGIS). 2. The north-south scale factor is always 111320, but the east-west scale factor is 111320*cos(latitude*pi/180). At high latitudes this difference will create significant problems and you probably need to reproject into a meter coordinate system (e.g., UTM) before calculating. At low latitudes, you might try splitting the difference: s = 111320 * 0.5 * (1 + cos(latitude*pi/180)). Commented Jun 11, 2016 at 21:11
4

When working with DEMs in lat long coordinates with their units in decimal degrees and the vertical units in meters you have to set the "scale (ratio of vertical units to horizontal units) to 111120. In

http://www.gdal.org/gdaldem.html

they even suggests that this setting for DEMs with lantlon coordinates and vertical units in feet, the scale must be set to 370400

This settings affects also the slope calculations.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.