[GRASS-dev] r.drain cumulative flag

Michael Barton michael.barton at asu.edu
Wed Nov 19 18:59:52 EST 2008


In working with r.drain to create a least-cost path map, it seems that  
the -c flag creates a path with cumulative values, but not one that I  
can see is usable for anything.

What happens now is that starting at the beginning of the path, each  
cell adds the underlying cost surface (or elevation for a drainage  
map) value to the value of the preceding cell in the path. At the end,  
the last cell has a value of the sum of all the cost (or elevation)  
values between the start and the end. So for a path traversing cells  
of the following values...

300 | 200 | 100 | 0

The path cells would have the values...

300 | 500 | 600 | 600


This is indeed a cumulative cost, but not one that is useful for  
anything I can think of. What would be much more useful if each cell  
calculated the difference between the current cost value and the  
preceding one and added that to the preceding path value. For the cost  
surface above, the result would be...

0 | 100 | 200 | 300

This gives the actual cost of traversing the path at any point along  
the path and the total cost at the end. Note that this is different  
than just copying the underlying cost value into the path if the path  
is not a straight line.

Any interest in changing the behavior of -c or maybe making a -t  
(total) flag?

Michael
______________________________
C. Michael Barton, Professor of Anthropology
Director of Graduate Studies
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University
Tempe, AZ  85287-2402
USA

voice: 480-965-6262; fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton



More information about the grass-dev mailing list