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

Margherita Di Leo diregola at gmail.com
Tue Jan 8 09:21:06 PST 2013


On Tue, Jan 8, 2013 at 6:20 PM, Margherita Di Leo <diregola at gmail.com>wrote:

> Markus,
>
> On Tue, Jan 8, 2013 at 5:44 PM, Markus Metz <markus.metz.giswork at gmail.com
> > wrote:
>
>> On Tue, Jan 8, 2013 at 3:41 PM, Margherita Di Leo <diregola at gmail.com>
>> wrote:
>> > Thanks for super quick answer,
>> >
>> > On Tue, Jan 8, 2013 at 3:25 PM, Markus Metz <
>> markus.metz.giswork at gmail.com>
>> > wrote:
>> >>
>> >>
>> >> Check if the friction map is not all zero or NULL for the second
>> >> polygon,
>> >
>> >
>> > the friction map within the ending polygon has everywhere value 1.
>>
>> And what are the values of the friction map outside the ending
>> polygon? Should also be 1 I guess.
>>
>
> Sorry my mistake, I just checked the wrong map -_-" sorry. It just works
> as you stated.
>
>>
>> >>
>> >> that the second
>> >> polygon is actually reachable from the first polygon in the output of
>> >> r.walk,
>> >
>> >
>> > Not sure how to verify that, but i digitized a random point within the
>> > ending polygon (i placed it somewhere in the center) and i used it as
>> > starting point for r.drain, and obtained a nice least cost path line.
>>
>> Interesting. Are the costs anywhere larger than zero?
>>
>
> Yes yes,
>
>>
>> >
>> >>
>> >> Also
>> >> have a look at the direction output of r.walk.
>> >
>> >
>> > Looks OK (it has values) but i'm still not sure what should i check in
>> it.
>>
>> That the directions make sense. In GRASS 7 as of r54582 they are
>> degrees CCW from East, zero is undefined, 360 is due East.
>>
>>
>> A little example in the NC dataset:
>>
>> # walking from Macon county to Dare county
>>
>> g.region -p rast=elev_state_500m at PERMANENT
>>
>> v.to.rast in=boundary_county at PERMANENT use=val val=1 where="NAME =
>> 'DARE'" out=dare
>>
>> v.to.rast in=boundary_county at PERMANENT use=val val=1 where="NAME =
>> 'MACON'" out=macon
>>
>> r.mapcalc "friction = 0.0001"
>>
>> # use Knight's move
>> r.walk elevation=elev_state_500m at PERMANENT friction=friction
>> output=dare_cost outdir=dare_dir start_rast=dare -k
>>
>> r.mask raster=macon
>>
>> r.out.xyz in=dare_cost out=- | sort -t "|" -k 3 | head -n3
>>
>> # gives
>> # 234250|147750|490937.498669579
>> # 234250|147250|491132.5043559544
>> # 234250|146750|491258.3433474401
>>
>> # Coordinates with lowest cost in Macon county are 234250,147750, and
>> the lowest cost is > zero.
>>
>> r.mask -r
>>
>> # use directions input because the input is a cost surface
>> # and vector output because of Knight's move in r.walk
>>
>> r.drain -d input=dare_cost indir=dare_dir output=macon2dare
>> vector_output=macon2dare start_coordinates=234250,147750
>>
>
> Thank you, I'm expanding the wiki with the example that you provided.
>
> Cheers,
> 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.
>



-- 
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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20130108/7ec43ef4/attachment.html>


More information about the grass-user mailing list