downstreamdist
Distance to the first cell downstream
Result = downstreamdist(ldd)
--unittrue or --unitcell
For each cell, assigns to Result the distance to the first cell downstream, where downstream cells are determined using the local drain directions on ldd. This distance is the length of one cell in case the local drain direction is to one of the right, left, top or bottom neighbouring cells or sqrt(2) multiplied by the length of one cell in case the local drain direction is to one of the 4 neighbouring cells in diagonal directions. In case a cell doesn’t have a downstream cell (i.e. a pit) a zero is assigned to Result.
A cell with a missing value on ldd is assigned a missing value on Result.
This operation belongs to the group of Neighbourhood operators; local drain directions
Result.map |
Ldd2.map |
![]() |
![]() |