[GRASS-dev] Re: [gdal-dev] gdaldem hillshade directions / GRASS r.shaded.relief

Hamish hamish_b at yahoo.com
Tue May 18 21:57:38 EDT 2010

Even wrote:
> #correct azimuth to East (GRASS convention):
> #  this seems to be backwards, but in fact it works so
> leave it.
> az = float(azimuth) - 90

I'm not into checking-in fudge factors which I don't understand,
and I seem to recall that when I wrote that comment I did
actually investigate the r.mapcalc algorithm and determine that
it was "in fact" doing the right thing, or at least verified the
output was correct.

GRASS has, for decades, used the mathematical convention of
theta measured CCW from the positive x-axis for measuring
aspect, not the nautical convention of of degrees measured CW
from north. Both ways are neither right nor wrong, it's just the
convention used. (a reminder that grass's roots are in modeling
and mathematical analysis, not cartography)

The typical way to convert between the two conventions is:
  naut = 90 - theta
  theta = 90 - naut

There is the possiblity that when gdal copied this code from
GRASS they only got/rewrote half of it, or lost the matching
color table, etc.  ??

If you like add it as a wish in the grass trac'er assigned to me,
I could dig into it at some time in the future. sorry I don't
have much time at all right now to look into itfurther. Only to
say that I have looked into this in the past and signed off on
it as ok back then (for use within GRASS, no idea about gdal's

hope that helps a little,


More information about the grass-dev mailing list