Flow Direction (Spatial Analyst)

Available with Spatial Analyst license.

Summary

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

Learn more about how Flow Direction works

Illustration

Flow Direction tool illustration
Flow_Dir = FlowDirection(Elev_Ras, #, #, D8)

Usage

  • The Flow Direction tool supports three flow modeling algorithm: D8, Multiple 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 using 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:

    Flow Direction values

    For example, if the direction of steepest drop is to the left of the current processing cell, its flow direction value is 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 described 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 this case, 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. Cells with undefined flow direction can be flagged as sinks using the Sink tool.

    • 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 D8 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.

  • The 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.

    Note:

    The MFD flow direction type only supports the creation of an output flow direction raster in Cloud Raster Format (CRF), such as flowdir1.crf, in a folder workspace.

    The MFD flow direction output when added to a map only displays the D8 flow directions. As MFD flow directions have potentially multiple values related to each cell (each value corresponds to the 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 will use the MFD flow directions to proportion and accumulate flow from each cell to all downslope neighbors.

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

  • With the Force all edge cells to flow outward parameter unchecked (force_flow = "NORMAL" in Python), the default setting, 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.

  • This tool supports parallel processing. If your computer has multiple processors or processors with multiple cores, better performance may be achieved, particularly on larger datasets. The Parallel processing with Spatial Analyst help topic includes details about this capability and how to configure it.

    When using parallel processing, temporary data will be written to manage the data chunks being processed. The default temp folder location will be on your local C: drive. You can control the location of this folder by setting up a system environment variable named TempFolders and specifying the path to a folder to use (for example, E:\RasterCache). If you have administrator privileges on your machine, you can also use a registry key (for example, [HKEY_CURRENT_USER\SOFTWARE\ESRI\ArcGISPro\Raster]).

    By default, this tool will use 50 percent of the available cores. If the input data is smaller than 5,000 by 5,000 cells in size, fewer cores may be used. You can control the number of cores the tool uses with the Parallel processing factor environment.

  • See Analysis environments and Spatial Analyst for additional details on the geoprocessing environments that apply to this tool.

  • 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.

Parameters

LabelExplanationData Type
Input surface raster

The input raster representing a continuous surface.

Raster Layer
Force all edge cells to flow outward
(Optional)

Specifies whether edge cells will always flow outward or follow normal flow rules.

  • Unchecked—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.
  • Checked—All cells at the edge of the surface raster will flow outward from the surface raster.
Boolean
Output drop raster
(Optional)

An optional output drop raster.

The drop raster returns the ratio of the maximum change in elevation from each cell along the direction of flow to the path length between centers of cells, expressed in percentages.

This output is of floating-point type.

Raster Dataset
Flow direction type
(Optional)

Specifies the type of flow method that will be used when computing flow directions.

  • D8Flow direction will be determined by the D8 method. This method assigns flow direction to the steepest downslope neighbor. This is the default.
  • MFDFlow direction will be based on the MFD flow method. Flow direction will be partitioned across downslope neighbors according to an adaptive partition exponent.
  • DINFFlow direction will be based on the DINF flow method. This method assigns flow direction to the steepest slope of a triangular facet.
String

Return Value

LabelExplanationData Type
Output flow direction raster

The output raster that shows the flow direction from each cell to its downslope neighbors or neighbors using the D8, MFD, or DINF method.

This output is of integer type.

Raster

FlowDirection(in_surface_raster, {force_flow}, {out_drop_raster}, {flow_direction_type})
NameExplanationData Type
in_surface_raster

The input raster representing a continuous surface.

Raster Layer
force_flow
(Optional)

Specifies whether edge cells will always flow outward or follow normal flow rules.

  • NORMALIf 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.
  • FORCEAll cells at the edge of the surface raster will flow outward from the surface raster.
Boolean
out_drop_raster
(Optional)

An optional output drop raster.

The drop raster returns the ratio of the maximum change in elevation from each cell along the direction of flow to the path length between centers of cells, expressed in percentages.

This output is of floating-point type.

Raster Dataset
flow_direction_type
(Optional)

Specifies the type of flow method that will be used when computing flow directions.

  • D8Flow direction will be determined by the D8 method. This method assigns flow direction to the steepest downslope neighbor. This is the default.
  • MFDFlow direction will be based on the MFD flow method. Flow direction will be partitioned across downslope neighbors according to an adaptive partition exponent.
  • DINFFlow direction will be based on the DINF flow method. This method assigns flow direction to the steepest slope of a triangular facet.
String

Return Value

NameExplanationData Type
out_flow_direction_raster

The output raster that shows the flow direction from each cell to its downslope neighbors or neighbors using the D8, MFD, or DINF method.

This output is of integer type.

Raster

Code sample

FlowDirection example 1 (Python window)

This example creates a D8 flow direction raster from an input Grid elevation surface raster.

import arcpy
from arcpy import env
from arcpy.sa import *
env.workspace = "C:/sapyexamples/data"
outFlowDirection = FlowDirection("elevation", "NORMAL")
outFlowDirection.save("C:/sapyexamples/output/outflowdir01")
FlowDirection example 2 (stand-alone script)

This example creates a D8 flow direction raster from an input Grid elevation surface raster.

# Name: FlowDirection_Example.py
# Description: Creates a raster of flow direction from each cell to its
#    steepest downslope neighbor.
# Requirements: Spatial Analyst Extension

# Import system modules
import arcpy
from arcpy import env
from arcpy.sa import *

# Set environment settings
env.workspace = "C:/sapyexamples/data"

# Set local variables
inSurfaceRaster = "elevation"
outDropRaster = "C:/sapyexamples/output/dropraster"

# Execute FlowDirection
outFlowDirection = FlowDirection(inSurfaceRaster, "FORCE", outDropRaster)

# Save the output 
outFlowDirection.save("C:/sapyexamples/output/outflowdir02")

Licensing information

  • Basic: Requires Spatial Analyst
  • Standard: Requires Spatial Analyst
  • Advanced: Requires Spatial Analyst

Related topics