# [GRASS-user] Time and slope: a hiking problem

Daniel Victoria daniel.victoria at gmail.com
Thu Feb 1 07:20:24 EST 2007

```Ok, let's say your trail goes from south to north. From the
r.slope.aspect manual we have that:
90deg is North (slope facing north) - I might be confused here,
someone shed some ligth
180 is West
270 is South
360 is East

So, for a trail going north, when you face a slope that has a 90
degree aspect, it means you will be going uphill... Or, for that
matter, any slope that is higher 0 degrees (0 is flat surface) and
equal or less then 180 degrees will be an uphill. Actually, 180 degree
aspect (W) and 360 (E) is a trail going on a "slanted" surface. A
better approach would be any aspect between 45 (NE) and 135 (NW) would
be uphill, fro this S-N trail and the rest, downhill...

90
___N___
|           |
180 W         E 360
|__ S__ |
270

Then, in r.mapcalc you would do:

new_slope = if(aspect > 45 && aspect < 135, slope, slope*-1)

the if statement is like this: if(condition, value if true, value if false)
I might have confused the positive and negative for uphill and
downhill on my previous email

This is just a general approach. There might be a way to convert your
trail to a vector path, break it down to smaller segments and
calculate the orientation for each segment. Then compare the vector
orientation to the slope aspect. But I have no idea how to do that...

Cheers
Daniel

On 2/1/07, Miguel Correia <miguellage.rc at gmail.com> wrote:
> Hi Daniel.
> You say
>
> "Then you just have to know the general orientation of the trail and
> you can come up with a rule in r.mapcalc and multiply all uphill areas
> of the trail by -1"
>
> It seams to me that you might be right, or at least what you say makes
> sense. But I have some doubts:
> How can I get to know this general orientation of the trail?
> Could you tell me more about that r.mapcalc rule to multiply all uphill
> areas of the trail by -1?
>
> The only thing that I don't understand is that if you multiply all uphill
> areas by -1, than it's like having all hills downhill, and the problem is
> that when a hiker goes uphill there must be a positive slope value, and when
> the hiker goes downhill I must have negative slope values.
>
> Thanks a lot!
>
>
>
> 2007/2/1, Daniel Victoria <daniel.victoria at gmail.com>:
> > The way I'd do it is calculate the aspect (r.slope.aspect). From the
> manual:
> >
> > --------------------
> > The aspect categories represent the number degrees of east and they
> > increase counterclockwise: 90deg is North, 180 is West, 270 is South
> > 360 is East, and the aspect value 0 is used to indicate undefined
> > aspect in flat areas with slope=0.
> > --------------------
> >
> > Then you just have to know the general orientation of the trail and
> > you can come up with a rule in r.mapcalc and multiply all uphill areas
> > of the trail by -1. Of course, if it's a circular trail or a very
> > curvy one, then this might not work...
> >
> > Cheers
> > Daniel
> >
> > On 2/1/07, Miguel Correia <miguellage.rc at gmail.com> wrote:
> > > Hello.
> > >
> > > I want to estimate off-path travelling with Tobler's hiking function.
> This
> > > function says that, for example, in a slope value of 10º the travelling
> > > velocity is 3Km/hr and in a slope value of -10º the velocity is 4km/hr.
> This
> > > generates a friction surface, in which the cost value is the cost of
> > > traversing that cell in Km/hr. Then, through r.mapcalc I divide the
> distance
> > > (cell resolution) by this friction surface to generate another friction
> > > surface with the corresponding time values.
> > > The aim of all this is to generate an accumulative cost surface (using
> > > r.cost with –k flag) from a given point and then get the isochrones (of
> 1
> > > hour, 2 hours, etc.).
> > > The problem is that the function needs negative slope values if the
> hiker
> > > goes downhill or positive values is the hiker goes uphill. Has you might
> > > imagine, If the slope surface only have positive values is the same that
> > > hiker would always go uphill and never downhill!
> > > How can Grass resolve this?
> > >
> > > Miguel.
> > > _______________________________________________
> > > grassuser mailing list
> > > grassuser at grass.itc.it
> > > http://grass.itc.it/mailman/listinfo/grassuser
> > >
> > >
> >
>
>

```