Flow direction
Algorithm
In a (sink-free) Digital Elevation Model (DEM), the Flow direction operation determines into which neighbouring pixel any water in a central pixel will flow naturally.
Flow direction is calculated for every central pixel of input blocks of 3 by 3 pixels, each time comparing the value of the central pixel with the value of its 8 neighbours. The output map contains flow directions as N (to the North), NE (to the North East), etc.
Steepest slope method:
- For each block of 3x3 input pixels, the operation calculates the height difference between the central pixel (CP) and each of the 8 neighbour pixels.
- If, for a neighbour, the height difference is positive (i.e. central pixel has larger value than the specific neighbour), then:
- for corner neighbours, height differences are divided by (distance) 1.4
- for horizontal neighbours, height differences are divided by (distance) 1
This determines the steepness between the central pixel and its neigbours.
- Then, the (position of the) neighbour with the largest 'steepness' value is the output flow direction for the current central pixel.
Input values: |
|
Height differences: |
|
|
Distances: |
|
|
Steepest slope: |
|
Output flow direction: |
 |
|
 |
/ |
|
 |
= |
|
 |
|
 |
Lowest height method:
- For each block of 3x3 input pixels, the operation calculates the height difference between the central pixel (CP) and each of the 8 neighbour pixels;
- From all neighbours with a positive height difference, (i.e. central pixel has larger value than a specific neighbour),
(the position of) the neighbour with largest positive height difference is the output flow direction for the current central pixel.
Input values: |
Height differences: |
Largest height difference: |
Output flow direction: |
 |
 |
 |
 |
Additional rules that are applied:
- Pixels along the edges of the input map (margins and corners) will always return the undefined value in the output map.
- If all neighbouring pixels of a central pixel have a larger value than the central pixel itself (i.e. a sink or pit), the undefined value will be returned in the output map.
In principle, this situation should not occur; it is advised to use a sink-free input DEM.
- When a central pixel has the undefined value, undefined will be returned in the output map.
- Neighbour pixels that have the undefined value are ignored during the calculation.
- If from eight neighbour pixels considered, three adjacent neighbour pixels in a single row or column are found to have the same steepest slope or the same smallest height value, then the position of the neighbour pixel that is in the middle of those three neighbours is used.
- If from eight neighbour pixels considered, two neighbour pixels are found to have the same steepest slope or smallest height value, then the position of one of these two neighbour pixels is used arbitrarily.
See also:
Flow direction : functionality