[GRASS-dev] [GRASS GIS] #3468: r.drain: replace with new r.path, support multiple directions

GRASS GIS trac at osgeo.org
Wed Dec 20 11:32:27 PST 2017


#3468: r.drain: replace with new r.path, support multiple directions
--------------------------+---------------------------------
  Reporter:  mmetz        |      Owner:  grass-dev@…
      Type:  enhancement  |     Status:  new
  Priority:  normal       |  Milestone:  7.5.0
 Component:  Raster       |    Version:  svn-releasebranch74
Resolution:               |   Keywords:  r.drain
       CPU:  All          |   Platform:  All
--------------------------+---------------------------------

Comment (by wenzeslaus):

 Replying to [ticket:3468 mmetz]:
 > A new module r.path could be added that uses a direction map with
 optional surface map to trace paths. r.drain could then be converted to a
 script calling r.path. If no direction map is supplied, r.fill.dir can be
 used by r.drain to create a direction map.

 Sounds good. Similar to the case of r.grow and r.grow.distance (and
 replacing what is now r.grow.shrink in addons).

 Once r.drain is a script, it would be great if we can manage to also
 remove the need for providing a "dummy" cost map. See `r.mapcalc "const1 =
 1"` in a r.drain example I created recently (please, correct me if I'm
 wrong):

 https://grass.osgeo.org/grass74/manuals/r.drain.html#path-following-
 directions

 > r.fill.dir uses a bitmask to encode multiple directions from a single
 cell, as described by Jenson and Domingue (1988). These multiple
 directions are internally resolved to find the main (single) flow
 direction which is then recoded to a standard direction format using
 degrees. This bitmask to encode multiple directions from a single cell
 could be used and exposed by various other modules,

 This makes sense to me also in light of what I have recently dealt with in
 r71809 (null values if conversion fails). We are potentially throwing out
 information and this was partially related to the fact that until recently
 it was hiding some potential problems in r.fill.dir (the problems are
 still there, just not as hidden as before).

 Jenson and Domingue (1988) is a format described in a paper and it makes
 sense adding it. Any ideas for a name? The current ones (in r.fill.dir)
 are not really descriptive (agnps, answers, grass).

 > i.e. r.cost, r.walk, r.watershed, to be used as input for r.path.

 One common format for all modules would be great. It is strange when user
 needs to recompute the angles like in my r.drain example from above
 (again, correct me if I'm wrong):

 https://grass.osgeo.org/grass74/manuals/r.drain.html#path-following-
 directions

 > the least costly path from a single start point to a single stop point
 can split and merge repeatedly (see attached multiple-directions-
 path.png).

 Looks great!

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3468#comment:2>
GRASS GIS <https://grass.osgeo.org>



More information about the grass-dev mailing list