Markus,<div><br></div><div>Thank you for replying and sorry for delay,<br><br><div class="gmail_quote">On Fri, Dec 28, 2012 at 4:37 PM, Markus Metz <span dir="ltr"><<a href="mailto:markus.metz.giswork@gmail.com" target="_blank">markus.metz.giswork@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On Wed, Dec 19, 2012 at 3:25 PM, Margherita Di Leo <<a href="mailto:diregola@gmail.com">diregola@gmail.com</a>> wrote:<br>

> Hi All,<br>
><br>
> I have a friction map, a start polygon and an end polygon and would like to<br>
> find the least cost path, meaning not a corridor but a thin line. To now<br>
> I've tried both r.cost and r.walk and r.drain eventually, but the result of<br>
> this latter<br>
><br>
> r.drain input=friction@PERMANENT output=rdrain_out<br>
> vector_points=start_line@PERMANENT<br>
><br>
> is a path calculated *within* the start polygon (a closed line).<br>
> I suppose this is because I don't provide a direction map to r.drain (I'm<br>
> using GRASS 7). I read:<br>
><br>
> If the input surface (a raster map layer) is a cumulative cost map generated<br>
> by the r.walk or r.cost modules, the -d flag and a movement direction<br>
> surface "indir" must be specified.<br>
><br>
> I assume it's a kind of flow direction or aspect, but what is the physical<br>
> meaning, and how can I calculate it? Could anyone please provide some<br>
> further info.<br>
<br>
</div>The physical meaning is movement direction in degrees CCW from East,<br>
similar to e.g. flow direction output of r.watershed. The direction<br>
map is an optional output of r.cost and r.walk, and should be used<br>
with the indir option for r.drain.<br>
<br>
The workflow would thus be:<br>
<br>
1) convert the first polygon to a raster map<br>
2) use all cells of the first polygon as start points for r.walk,<br>
include the friction map<br>
3) convert the second polygon to a raster map<br></blockquote><div><br></div><div>quite plain up to this point, but:</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">

4) use the second polygon as a MASK and get the coordinates of the<br>
cell with the lowest cost<br></blockquote><div><br></div><div>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?</div><div><br></div><div>Thanks in advance.</div>
<div><br></div><div>Best,</div><div>madi</div></div><div><br></div>-- <br><div><div><font color="#666666">Margherita DI LEO    </font></div><div><font color="#666666">Postdoctoral Researcher</font></div><div><font color="#666666"><br>
</font></div><div><font color="#666666">European Commission - DG JRC </font></div><div><font color="#666666">Institute for Environment and Sustainability (IES). Unit H03 – FRC</font></div><div><font color="#666666">Via Fermi, 2749</font></div>
<div><font color="#666666">I-21027 Ispra (VA) - Italy - TP 261</font></div><div><font color="#666666">       </font></div><div><font color="#666666">Tel. +39 0332 78 3600   </font></div><div><font color="#666666"><a href="mailto:margherita.di-leo@jrc.ec.europa.eu" target="_blank">margherita.di-leo@jrc.ec.europa.eu</a></font></div>
<div><font color="#666666"><br></font></div><div><font color="#666666">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.</font></div>
</div>
</div>