FlowDirections

Computes where the water of each cell flows. The directions are coded with the numbers of the HortonMachine, counterclockwise starting from east:

4

3

2

5

cell

1

6

7

8

The D8 method allows only these eight directions, which on smooth slopes leads to straight parallel flow paths that deviate from the real direction of steepest descent: DrainDir corrects them.

Details

The outlets are not marked with the conventional value 10, which several modules use to recognize them: run Markoutlets on the drainage directions when one of these follows.

Parameters

Calculates the drainage directions of a depitted elevation model with the D8 method: each cell drains to the neighbour of steepest descent among its eight neighbours. The directions are coded counterclockwise from 1 (east) to 8 (south-east).

Toolbox folder: Geomorphology
Status: Certified
Keywords: Geomorphology, Flow directions, D8
Authors: David Tarboton, Andrea Antonello
Class: org.hortonmachine.modules.FlowDirections

Inputs

Parameter

Type

Unit

Default

Description

inPit

raster file

The depitted elevation model.

pMinElev

double

0

The min elevation considered. Defaults to 0.

Outputs

Parameter

Type

Unit

Description

outFlow

output file

The map of the drainage directions (D8).

References

  • O’Callaghan, J. F., Mark, D. M. (1984). The extraction of drainage networks from digital elevation data. Computer Vision, Graphics, and Image Processing, 28(3), 323-344.

Example

The example runs on the sample elevation model of the manual, dtm_flanginec.tif in docs/manual/modules/maps/data, each module on the outputs of the previous ones:

import org.hortonmachine.modules.FlowDirections

// the folder with the elevation model: change it to yours
var folder = "/data/flanginec/"

var flowDirections = new FlowDirections()
flowDirections.inPit = folder + "pit.tif"
flowDirections.outFlow = folder + "flow.tif"
flowDirections.process()
The D8 drainage directions of the sample area, with the codes of the HortonMachine.

The D8 drainage directions of the sample area, with the codes of the HortonMachine.