Interesting.
Why r.slope.aspect uses
dx = ... / (4 * ewres);
while r.shaded.relief uses
dx = ... / (8 * ewres);
??
BTW there is a typo in r.shaded.relief in line 137 ("Nap"):
g.message -e "Nap <$elev> not found."
Carlos
On 7/4/07, Glynn Clements <[EMAIL PROTECTED]> wrote:
Yann wrote:
> In a given chain processing module (DN->high-level product) in development,
> there is a need of calculating slope and aspect, i would like to use the
> existing code as a library or something to the similar effect.
>
> Anyone could explain if it is possible and how it could be possible?
It isn't practical to use code from a module in a library.
Even if it was, calculating slope/aspect is so trivial that it's
easier to just write it from scratch than to extract the code from
r.slope.aspect.
FWIW, the calculation which r.slope.aspect uses is essentially:
dx = ((c1 + 2*c4 + c7) - (c3 + 2*c6 + c9)) / (4 * ewres);
dy = ((c7 + 2*c8 + c9) - (c1 + 2*c2 + c3)) / (4 * nsres);
key = dx*dx + dy*dy;
slp_in_perc = 100*sqrt(key);
slp_in_deg = atan(sqrt(key)) * radians_to_degrees;
aspect = (atan2(dy,dx)/degrees_to_radians);
where the cells are labelled:
c1 c2 c3
c4 c5 c6
c7 c8 c9
--
Glynn Clements <[EMAIL PROTECTED]>
_______________________________________________
grass-dev mailing list
[email protected]
http://grass.itc.it/mailman/listinfo/grass-dev
--
+-----------------------------------------------------------+
Carlos Henrique Grohmann - Guano
Visiting Researcher at Kingston University London - UK
Geologist M.Sc - Doctorate Student at IGc-USP - Brazil
Linux User #89721 - carlos dot grohmann at gmail dot com
+-----------------------------------------------------------+
_________________
"Good morning, doctors. I have taken the liberty of removing Windows
95 from my hard drive."
--The winning entry in a "What were HAL's first words" contest judged
by 2001: A SPACE ODYSSEY creator Arthur C. Clarke
_______________________________________________
grass-dev mailing list
[email protected]
http://grass.itc.it/mailman/listinfo/grass-dev