[GRASS-dev] Re: [gdal-dev] gdaldem hillshade directions / GRASS
r.shaded.relief
Hamish
hamish_b at yahoo.com
Sat May 22 00:55:56 EDT 2010
Even wrote:
> I've taken some time to experiment a bit with GRASS and
> GRASS behaviour is correct of course, so sorry for the noise.
>
> I've finally identified why gdaldem (and initially Matt's hillshade
> utility) got it wrong. GRASS r.mapcalc atan(x,y) function has its
> parameters reversed in comparison to C atan2() used by GDAL :
> atan(x,y)=atan2(y,x)....
>
> So the aspect computation was wrong which could also be seen as a wrong
> interpretation of the azimuth parameter. But for the particular value of
> az=315deg, the beauty of trigonometry makes it such that
> cos(az-pi/2-atan2 (y,x)) = cos(az-pi/2- atan2(x,y))...
>
> Fixed as ticket http://trac.osgeo.org/gdal/ticket/3586
well spotted! Let's just call this one a result of C's math lib being
weird and then none of us have to take the blame. :)
[so here's finally a case where lat,long misorder could help?]
cheers,
Hamish
More information about the grass-dev
mailing list