[GRASS-user] movement direction surface in r.drain

Markus Metz markus.metz.giswork at gmail.com
Tue Jan 8 06:25:03 PST 2013


On Tue, Jan 8, 2013 at 3:04 PM, Margherita Di Leo <diregola at gmail.com> wrote:
> Markus,
>
> Thank you for replying and sorry for delay,
>
> On Fri, Dec 28, 2012 at 4:37 PM, Markus Metz <markus.metz.giswork at gmail.com>
> wrote:
>>
>> On Wed, Dec 19, 2012 at 3:25 PM, Margherita Di Leo <diregola at gmail.com>
>> wrote:
>> > Hi All,
>> >
>> > I have a friction map, a start polygon and an end polygon and would like
>> > to
>> > find the least cost path, meaning not a corridor but a thin line. To now
>> > I've tried both r.cost and r.walk and r.drain eventually, but the result
>> > of
>> > this latter
>> >
>> > r.drain input=friction at PERMANENT output=rdrain_out
>> > vector_points=start_line at PERMANENT
>> >
>> > is a path calculated *within* the start polygon (a closed line).
>> > I suppose this is because I don't provide a direction map to r.drain
>> > (I'm
>> > using GRASS 7). I read:
>> >
>> > If the input surface (a raster map layer) is a cumulative cost map
>> > generated
>> > by the r.walk or r.cost modules, the -d flag and a movement direction
>> > surface "indir" must be specified.
>> >
>> > I assume it's a kind of flow direction or aspect, but what is the
>> > physical
>> > meaning, and how can I calculate it? Could anyone please provide some
>> > further info.
>>
>> The physical meaning is movement direction in degrees CCW from East,
>> similar to e.g. flow direction output of r.watershed. The direction
>> map is an optional output of r.cost and r.walk, and should be used
>> with the indir option for r.drain.
>>
>> The workflow would thus be:
>>
>> 1) convert the first polygon to a raster map
>> 2) use all cells of the first polygon as start points for r.walk,
>> include the friction map
>> 3) convert the second polygon to a raster map
>
>
> quite plain up to this point, but:
>
>>
>> 4) use the second polygon as a MASK and get the coordinates of the
>> cell with the lowest cost
>
>
> The cost map obtained by r.walk happens to be all 0 within the ending
> polygon. How should I choose my coordinates in this case?

Check if the friction map is not all zero or NULL for the second
polygon, that the DEM covers the second polygon, that the second
polygon was not used in any way as input for r.walk, that the second
polygon is actually reachable from the first polygon in the output of
r.walk, and that the current region covers the second polygon. Also
have a look at the direction output of r.walk.

HTH,

Markus M

>
> Thanks in advance.
>
> Best,
> madi
>
> --
> Margherita DI LEO
> Postdoctoral Researcher
>
> European Commission - DG JRC
> Institute for Environment and Sustainability (IES). Unit H03 – FRC
> Via Fermi, 2749
> I-21027 Ispra (VA) - Italy - TP 261
>
> Tel. +39 0332 78 3600
> margherita.di-leo at jrc.ec.europa.eu
>
> Disclaimer: The views expressed are purely those of the writer and may not
> in any circumstance be regarded as stating an official position of the
> European Commission.


More information about the grass-user mailing list