<div dir="ltr"><div><div><br><br>On Sun, Dec 17, 2017 at 5:36 AM, Anna Petrášová <<a href="mailto:kratochanna@gmail.com">kratochanna@gmail.com</a>> wrote:<br>><br>> Hi Nagy,<br>><br>> On Sat, Dec 16, 2017 at 2:06 PM, Nagy Edmond <<a href="mailto:nagy.edmond.eno@gmail.com">nagy.edmond.eno@gmail.com</a>> wrote:<br>> > Hi Anna,<br>> ><br>> > Thank you for pointing that out. It always computes one way between two<br>> > points indeed, but there is something that I should bring to light.<br>> ><br>> > While I was initially computing least-cost paths with r.drain using r.walk<br>> > outputs as inputs I noticed a possible problem. I ran two parallel tests<br>> > with the same two points. In the first one, A was the starting position,<br>> > while B the stop position. In the second one, B was the start point and A<br>> > the stop point. In r.walk, the results were anisotropic indeed, both the<br>> > walking cost and the movement direction raster outputs turned out different,<br>> > as it would have been expected. But the r.drain module sadly did not<br>> > generate different least-cost paths, despite using different inputs. I have<br>> > also checked this more than once, just to be sure of it.<br>> ><br>> > At one point I have also come across an article (Gietl et al. 2008 - link<br>> > below) where the authors discuss and compare l.c.p. results obtained with<br>> > different GIS (including GRASS), and they had also experienced some problem<br>> > with the module (page 4), but I am not sure if it's the same I'm having. In<br>> > any case, if nothing can be done about it, then I will mention the<br>> > limitation in the documentation.<br>> ><br>><br>> you are right that r.drain seem to create the same path from A to B<br>> and back, there are some slight differences, but that can be just<br>> numerical cause. I am not sure why is that, if my expectation that the<br>> path for that DEM should be different is incorrect, or there is some<br>> problem in the algorithm.<br><br></div>It depends on the slope factor. Here is an example, based on the example in the manual of r.walk (North Carolina sample dataset):<br><br>g.region region=swwake_30m -p<br><br># create friction map based on land cover<br>r.recode input=landclass96 out=friction rules=- << EOF<br>1:3:0.1:0.1<br>4:5:10.:10.<br>6:6:1000.0:1000.0<br>7:7:0.3:0.3<br>EOF<br><br>r.walk -k elevation=elev_ned_30m friction=friction output=walkcost_ab outdir=walkdir_ab start_coordinates=635576,216485 stop_coordinates=640206,222795 slope_factor=-0.05 lambda=0.5<br>r.drain -d input=walkcost_ab direction=walkdir_ab output=path_ab drain=path_ab start_coordinates=640206,222795<br><br>r.walk -k elevation=elev_ned_30m friction=friction output=walkcost_ba outdir=walkdir_ba start_coordinates=640206,222795 stop_coordinates=635576,216485 slope_factor=-0.05 lambda=0.5<br>r.drain -d input=walkcost_ba direction=walkdir_ba output=path_ba drain=path_ba start_coordinates=635576,216485<br><br></div>Here, the paths from A to B and from B to A are different. Depending on the settings, the paths can be nearly identical. Small differences can arise because there can be several paths from A to B with equal cumulative costs.<br><div><div><br>> I don't think what the paper refers to is<br>> the same thing though.<br></div><div><br></div><div>In this paper, GRASS 6.1.0 was used, and back then r.drain did not have the option to use a direction map as input, therefore r.drain could not be used with the output of r.cost/r.walk.<br></div><div><br></div><div>Right now, r.drain is somewhat overloaded: it creates directions for a DEM same way r.fill.dir does it, or it uses supplied directions, then the module extracts least costly paths. I suggest to have a new module r.path that extracts extract least costly paths from input directions and start points and mark r.drain as deprecated.</div><div><br></div><div>Markus M<br></div><div><br></div><div>><br>> Anna<br>><br>> > All the best,<br>> > Nagy Edmond<br>> ><br>> > article -<br>> > <a href="http://proceedings.caaconference.org/paper/106_gietl_et_al_caa2007/">http://proceedings.caaconference.org/paper/106_gietl_et_al_caa2007/</a><br>> ><br>> ><br>> ><br>> > --<br>> > Sent from: <a href="http://osgeo-org.1560.x6.nabble.com/GRASS-PSC-f4051248.html">http://osgeo-org.1560.x6.nabble.com/GRASS-PSC-f4051248.html</a><br>> > _______________________________________________<br>> > grass-psc mailing list<br>> > <a href="mailto:grass-psc@lists.osgeo.org">grass-psc@lists.osgeo.org</a><br>> > <a href="https://lists.osgeo.org/mailman/listinfo/grass-psc">https://lists.osgeo.org/mailman/listinfo/grass-psc</a><br>> _______________________________________________<br>> grass-psc mailing list<br>> <a href="mailto:grass-psc@lists.osgeo.org">grass-psc@lists.osgeo.org</a><br>> <a href="https://lists.osgeo.org/mailman/listinfo/grass-psc">https://lists.osgeo.org/mailman/listinfo/grass-psc</a><br><br></div></div></div>