Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#3586 closed defect (fixed)

gdaldem hillshade azimuth parameter wrongly interpreted

Reported by: Even Rouault Owned by: Even Rouault
Priority: normal Milestone: 1.7.3
Component: Utilities Version: 1.7.0
Severity: normal Keywords: gdaldem hillshade azimuth
Cc:

Description

Vincent Schut discovered that the azimuth parameter of gdaldem hillshade wasn't interpreted consistently with the documentation.

Instead of 0 = sun at the north, 90 at the east, 180 at the south and 270 at the west, we had 0 degrees is west, 90 is south, 180 is east and 270 is north

This could be easily demonstrated with the following Python script to generate a 4-face pyramid :

import gdal
import osr

ds = gdal.GetDriverByName('GTiff').Create('testdem.tif', 100, 100, 1)
ds.SetGeoTransform([2,0.01,0,49,0,-0.01])
sr = osr.SpatialReference()
sr.ImportFromEPSG(4326)
ds.SetProjection(sr.ExportToWkt())
for j in range(100):
    data = ''
    for i in range(100):
        val = 255 - 5 * max(abs(50-i),abs(50-j))
        data = data + ('%c' % (val))
    ds.GetRasterBand(1).WriteRaster(0,j,100,1,data)

ds = None

and following gdaldem commandline : gdaldem  hillshade testdem.tif testdem_shaded.tif -s 111120 -z 100 -az XXXX

Change History (2)

comment:1 Changed 10 years ago by Even Rouault

Resolution: fixed
Status: newclosed

Fixed in trunk (r19743) and branches/1.7 (r19744)

comment:2 Changed 10 years ago by Even Rouault

Test added in r19767

Note: See TracTickets for help on using tickets.