Module r.stream.distance may calculate distance using two methods: downstream and upstream.
The default is downstream method when it calculates distance to streams and outlets and relative elevation to streams and outlets. The distance and elevation is calculated along watercourses. In outlets mode it can also calculate parameters for subbasins.
In streams mode (default) it calculates that parameters downstream to streams which are added as stream mask. In outlets mode there are some additional possibilities. If subbasin is off it calculate parameters only for last point of last (downstream) CELL. In subbasin mode it calculates parameters for every subbasin separately. Subbasin mode acts similar to subbasin mask. Streams file prepared to create basins and subbasins with r.stream.basins can be used to calculate distance and elevation parameters.
With upstream method it calculates distance to the local maximum or divide. Opposite to downstream method, where every cell has one and only one downstream cell in upstream method every cell has usually more than one upstream cell. So it is impossible to determine interchangeable path from any cell. The upstream method offers two alternative modes switched with -n flag: nearest local maximum/divide: means the shortest path to local maximum and default option farthest maximum/divide means the longest path. In hydrological sense, nearest mode means the shortest path which a particle of water must run from divide to reach particular cell, while farthest mode means the possible longest path.
If there are more than one point or one stream network and some separate points or separate streams networks are in catchment area defined by others it will results as in subbasin mode. In stream mode subbasin options is omited. Input maps must be in CELL format (default output of r.watershed, r.stream.order and r.stream.extract). The distance are calculated in meters both for planimeters and Latitude-Longitude projections. The distance is calculated for flat areas not corrected by topography. Distance correction by topography may be done with following r.mapcalc formula:
r.mapcalc "dist_corrected = sqrt(distance^2 + elevation^2)"
Probably one of the most imortant features of r.stream.distance is the ability to calculate distance not only for streams generated with r.stream.extract, but also to any CELL map with resolution corresponding to direction map. It can be a lake, swamp, depression and lake boundaries even divided into smaller fragments each with its own category.
g.region -p -a rast=elevation r.watershed elevation=elevation threshold=10000 drainage=direction stream=streams r.stream.distance stream_rast=streams direction=direction elevation=elevation \ method=downstream distance=distance_stream_downstream difference=difference_stream_downstream r.stream.distance stream_rast=streams direction=direction elevation=elevation \ method=upstream distance=distance_stream_upstream difference=difference_stream_upstream
Last changed: $Date$