# Flow Direction

## Summary

Calculates the direction of flow from each cell to its downslope neighbor or neighbors using the D8, D-Infinity (DINF), or Multiple Flow Direction (MFD) method.

## Usage

• The Flow Direction tool supports three flow modeling algorithms. Those are D8, Multi Flow Direction (MFD) and D-Infinity (DINF).

• The D8 flow method models flow direction from each cell to its steepest downslope neighbor.

The output of the Flow Direction tool run with the D8 flow direction type is an integer raster whose values range from 1 to 255. The values for each direction from the center are the following:

For example, if the direction of steepest drop was to the left of the current processing cell, its flow direction would be coded as 16.

• If a cell is lower than its eight neighbors, that cell is given the value of its lowest neighbor, and flow is defined toward this cell. If multiple neighbors have the lowest value, the cell is still given this value, but flow is defined with one of the two methods explained below. This is used to filter out one-cell sinks, which are considered noise.

• If a cell has the same change in z-value in multiple directions and that cell is part of a sink, the flow direction is referred to as undefined. In such cases, the value for that cell in the output flow direction raster will be the sum of those directions. For example, if the change in z-value is the same both to the right (flow direction = 1) and down (flow direction = 4), the flow direction for that cell is 1 + 4 = 5. By using the Spatial Analyst Sink tool can be used to flag Cells with undefined flow direction as sinks,

• If a cell has the same change in z-value in multiple directions and is not part of a sink, the flow direction is assigned with a lookup table defining the most likely direction. See Greenlee (1987).

The output drop raster is calculated as the difference in z-value divided by the path length between the cell centers, expressed in percentages. For adjacent cells, this is analogous to the percent slope between cells. Across a flat area, the distance becomes the distance to the nearest cell of lower elevation. The result is a map of percent rise in the path of steepest descent from each cell.

When calculating the drop raster in flat areas, the distance to diagonally adjacent cells (1.41421 * cell size) is approximated by 1.4 * cell size for improved performance.

• The Multiple Flow Direction (MFD) algorithm, described by Qin et al. (2007), partitions flow from a cell to all downslope neighbors. A flow-partition exponent is created from an adaptive approach based on local terrain conditions and is used to determine fraction of flow draining to all downslope neighbors.

The MFD flow direction output when added to a map only displays the D8 flow directions. As MFD flow directions have potentially multiple values tied to each cell (each value corresponds to proportion of flow to each downslope neighbor), it is not easily visualized. However, an MFD flow direction output raster is an input recognized by the Flow Accumulation tool that would utilize the MFD flow directions to proportion and accumulate flow from each cell to all downslope neighbors.

• The D-Infinity (DINF) flow method, described by Tarboton (1997), determines flow direction as the steepest downward slope on eight triangular facets formed in a 3x3 cell window centered on the cell of interest. Flow direction output is a floating point raster represented as a single angle in degrees going counter-clockwise from 0 (due east) to 360 (again due east).

• With the Force all edge cells to flow outward parameter in the default value (NORMAL), a cell at the edge of the surface raster will flow toward the inner cell with the steepest drop in z-value. If the drop is less than or equal to zero, the cell will flow out of the surface raster.

• References:

Greenlee, D. D. 1987. "Raster and Vector Processing for Scanned Linework." Photogrammetric Engineering and Remote Sensing 53 (10): 1383–1387.

Qin, C., Zhu, A. X., Pei, T., Li, B., Zhou, C., & Yang, L. 2007. "An adaptive approach to selecting a flow partition exponent for a multiple flow direction algorithm." International Journal of Geographical Information Science 21(4): 443-458.

Tarboton, D. G. 1997. "A new method for the determination of flow directions and upslope areas in grid digital elevation models." Water Resources Research 33(2): 309-319.

## Syntax

`FlowDirection_ra (inputSurfaceRaster, outputFlowDirectionName, {forceFlow}, {flowDirectionType}, outputDropName)`
 Parameter Explanation Data Type inputSurfaceRaster The input raster representing a continuous surface. Raster Layer; Image Service; String outputFlowDirectionName The name of the output flow direction raster service.The default name is based on the tool name and the input layer name. If the layer already exists, you will be prompted to provide another name. String forceFlow(Optional) Keywords defining if NoData values in the input raster are allowed to nibble into the area defined by the mask raster.NORMAL —If the maximum drop on the inside of an edge cell is greater than zero, the flow direction will be determined as usual; otherwise, the flow direction will be toward the edge. Cells that should flow from the edge of the surface raster inward will do so. This is the default.FORCE —All cells at the edge of the surface raster will flow outward from the surface raster. Boolean flowDirectionType(Optional) Specifies the type of flow method to use while computing flow directions.D8 —Assign a flow direction based on the D8 flow method. This method assigns flow direction to the steepest downslope neighbor. This is the default.MFD —Assign a flow direction based on the MFD flow method. This method assigns multiple flow directions towards all downslope neighbors.DINF —Assign a flow direction based on the D-Infinity flow method using the steepest slope of a triangular facet. String outputDropName The name of the output drop raster service.The default name is based on the tool name and the input layer name. If the layer already exists, you will be prompted to provide another name. String

#### Derived Output

 Name Explanation Data Type outputFlowDirectionRaster The output flow direction raster. Raster Layer outputDropRaster The output drop raster. Raster Layer

## Code sample

FlowDirection example 1 (Python window)

This example creates a flow direction raster from the input surface raster.

``````import arcpy
arcpy.FlowDirection_ra("https://myserver/rest/services/elevation/ImageServer","outD8FlowDir1")``````
FlowDirection example 2 (stand-alone script)

This example creates a flow direction raster from the input surface raster.

``````#---------------------------------------------------------------------------
# Name: FlowDirection_example02.py
# Requirements: ArcGIS Image Server

# Import system modules
import arcpy

# Set local variables
inSurface = "https://myserver/rest/services/elevation_filled/ImageServer"
outputFlowDirection = "outD8FlowDir2"
forceFlow = "NORMAL"
flowDirectionType = "D8"

# Execute Flow Direction raster analysis tool
arcpy.FlowDirection_ra(inSurface, outputFlowDirection, forceFlow, flowDirectionType)``````

## Licensing information

• Basic: Requires ArcGIS Image Server
• Standard: Requires ArcGIS Image Server
• Advanced: Requires ArcGIS Image Server