[GRASS-dev] [GRASS GIS] #399: Added "backlink" functionality to r.walk, r.cost & r.drain

#399: Added "backlink" functionality to r.walk, r.cost & r.drain
--------------------------+-------------------------------------------------
  Reporter: cnielsen | Owner: grass-dev@lists.osgeo.org
      Type: enhancement | Status: new
  Priority: major | Milestone: 6.4.0
Component: Raster | Version: unspecified
Resolution: | Keywords:
  Platform: All | Cpu: All
--------------------------+-------------------------------------------------
Comment (by cmbarton):

This works very nicely in tests on Mac OSX Intel, develbranch_6.

It produces more accurate least cost paths (r.drain apparently is
incorrect in some cases). It would be nice to get this into all branches
ASAP to avoid errors with r.drain.

Michael

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/399#comment:17&gt;
GRASS GIS <http://grass.osgeo.org>

#399: Added "backlink" functionality to r.walk, r.cost & r.drain
--------------------------+-------------------------------------------------
  Reporter: cnielsen | Owner: grass-dev@lists.osgeo.org
      Type: enhancement | Status: new
  Priority: major | Milestone: 6.4.0
Component: Raster | Version: unspecified
Resolution: | Keywords:
  Platform: All | Cpu: All
--------------------------+-------------------------------------------------
Comment (by cnielsen):

Fixed some spacing issues, patches now only contain "hunks" of genuine
changes and not extra spaces.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/399#comment:18&gt;
GRASS GIS <http://grass.osgeo.org>

#399: Added "backlink" functionality to r.walk, r.cost & r.drain
--------------------------+-------------------------------------------------
  Reporter: cnielsen | Owner: grass-dev@lists.osgeo.org
      Type: enhancement | Status: new
  Priority: major | Milestone: 6.4.0
Component: Raster | Version: unspecified
Resolution: | Keywords:
  Platform: All | Cpu: All
--------------------------+-------------------------------------------------
Comment (by dylan):

Just re-compiled GRASS with Colin's recent patches to r.cost, r.drain, and
r.walk. Compiles fine against develbranch_6 on linux, with visibly
different results. Using the output direction update to r.cost/r.drain
does not appear to differ much from the original implementation. The
results from r.walk/r.drain using the output direction patch results in
considerably differences-- that appear to be non-optimal in this terrain.
Code and resulting output posted here:

http://casoilresource.lawr.ucdavis.edu/drupal/node/544#comment-948

Thanks for the work on these modules. I wonder if using more than the
cardinal directions would result in a more realistic "direction map".

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/399#comment:19&gt;
GRASS GIS <http://grass.osgeo.org>

#399: Added "backlink" functionality to r.walk, r.cost & r.drain
--------------------------+-------------------------------------------------
  Reporter: cnielsen | Owner: grass-dev@lists.osgeo.org
      Type: enhancement | Status: new
  Priority: major | Milestone: 6.4.0
Component: Raster | Version: unspecified
Resolution: | Keywords:
  Platform: All | Cpu: All
--------------------------+-------------------------------------------------
Comment (by dylan):

Actually, after looking at the new output from r.walk/r.drain, the
linearity of the shortest cost path made me think that the path was
somehow non-optimal. It is actually much shorter (by 1.2km), and probably
not impossible in this terrain.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/399#comment:20&gt;
GRASS GIS <http://grass.osgeo.org>

#399: Added "backlink" functionality to r.walk, r.cost & r.drain
--------------------------+-------------------------------------------------
  Reporter: cnielsen | Owner: grass-dev@lists.osgeo.org
      Type: enhancement | Status: new
  Priority: major | Milestone: 6.4.0
Component: Raster | Version: unspecified
Resolution: | Keywords:
  Platform: All | Cpu: All
--------------------------+-------------------------------------------------
Comment (by cnielsen):

Thanks for the testing and the how-to Dylan. I should emphasize that the
changes I made only record the directions taken by the original cost
accumulation algorithm. These means that I have not (well only a slight
change to fix a mathematical error) changed how r.cost or r.walk
calculates paths, only how those same paths are recorded and then turned
into paths using r.drain.

The clearest way I can put it is to think of the knight's move. With the
old modules, r.drain had no way to tell if the cost surface was created
with or without knight's move. Instead it just followed a water drop
"drain" through the map only looking at 8 neighbours. Now it uses the
direction surface to remember what the cost accumulation algorithm did and
recreates that path.

Therefore the cardinal directions are necessary (and precisely sufficient)
since they record either eight directions, or for knight's move sixteen
directions, based on the original moves... does that make sense?

Also patches for grass_trunk aka grass70 are ready for testing (they work
for me).

-Colin

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/399#comment:21&gt;
GRASS GIS <http://grass.osgeo.org>

#399: Added "backlink" functionality to r.walk, r.cost & r.drain
--------------------------+-------------------------------------------------
  Reporter: cnielsen | Owner: grass-dev@lists.osgeo.org
      Type: enhancement | Status: new
  Priority: major | Milestone: 6.4.0
Component: Raster | Version: unspecified
Resolution: | Keywords:
  Platform: All | Cpu: All
--------------------------+-------------------------------------------------
Comment (by cmbarton):

I've just committed the stash.h file.

Michael

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/399#comment:22&gt;
GRASS GIS <http://grass.osgeo.org>

#399: Added "backlink" functionality to r.walk, r.cost & r.drain
--------------------------+-------------------------------------------------
  Reporter: cnielsen | Owner: grass-dev@lists.osgeo.org
      Type: enhancement | Status: new
  Priority: major | Milestone: 6.4.0
Component: Raster | Version: unspecified
Resolution: | Keywords:
  Platform: All | Cpu: All
--------------------------+-------------------------------------------------
Comment (by neteler):

Added to GRASS 7: r36614, r36615, r36616.

If ok, please close the ticket.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/399#comment:23&gt;
GRASS GIS <http://grass.osgeo.org>

#399: Added "backlink" functionality to r.walk, r.cost & r.drain
--------------------------+-------------------------------------------------
  Reporter: cnielsen | Owner: grass-dev@lists.osgeo.org
      Type: enhancement | Status: closed
  Priority: major | Milestone: 6.4.0
Component: Raster | Version: unspecified
Resolution: fixed | Keywords:
  Platform: All | Cpu: All
--------------------------+-------------------------------------------------
Changes (by cnielsen):

  * status: new => closed
  * resolution: => fixed

Comment:

Seems ok to me.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/399#comment:24&gt;
GRASS GIS <http://grass.osgeo.org>