[GRASS-user] What algorithm does r.drain use?

Markus Metz markus.metz.giswork at gmail.com
Thu Jan 8 23:50:55 PST 2015


On Fri, Jan 9, 2015 at 5:12 AM, Takenori KANAI <kanai at ube-c.ac.jp> wrote:
> Markus N and Markus M,
>
> Thankyou for your response.
>
> I see. If on the first step, more surrounding cells have the same
> minimum cost, which is the first cell encountered
> used (like follows: a is greater than surraounding cells)?
> I'm sorry the question on the abc.
>
> 2  2  2
> 2  a  2
> 2  2  2
>
I was wrong. In this case all cells with the minimum cost are added
and the direction is resolved later. The way how this direction is
resolved is not documented, unfortunately. There are 247 possible
cases where directions need to be resolved, these have been
hard-coded.

Markus M

> Thanks
>
> Takenori K.
>
> To my knowledge there is no scientific paper available related to the
> r.drain algorithm.
> It has been written by Roger S. Miller in 2001 (replacing an older and
> less functional version).
>
> You may see the internals here in the code base:
> http://trac.osgeo.org/grass/browser/grass/trunk/raster/r.drain
>
> Maybe other users know more about this algorithm family?
>
> Best
> Markus N
>
> r.drain simply follows the lowest cost in the surrounding cells (must
> be lower than the current cell). If more surrounding cells have the
> same minimum cost, the first cell encountered is used.
>
> Markus M
>
>
> _______________________________________________
> grass-user mailing list
> grass-user at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-user


More information about the grass-user mailing list