Creates a raster of flow direction from each cell to its steepest downslope neighbor.
Learn more about how Flow Direction works
Illustration

Creates a raster of flow direction from each cell to its steepest downslope neighbor.
Learn more about how Flow Direction works

Command line and Scripting
The output of the Flow Direction tool is an integer raster whose values range from 1 to 255. The values for each direction from the center are: 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. Cells with undefined flow direction can be flagged as sinks using the Sink function.
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 {out_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 {out_drop_raster} in flat areas, the distance to diagonally adjacent cells (1.414 * cell size) is approximated by 1.5 * cell size to increase the processing speed by using integer calculations.
When using the NORMAL option, 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.
The following environment settings affect this tool:
Map Algebra
The output of FlowDirection is an integer raster whose values range from 1 to 255. The values for each direction from the center are: 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 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. Cells with undefined flow direction can be flagged as sinks using the Sink function.
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 {o_drop_grid} 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 {o_drop_grid} in flat areas, the distance to diagonally adjacent cells (1.414 * cell size) is approximated by 1.5 * cell size to increase the processing speed by using integer calculations.
When using the NORMAL option, 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.
Learn more about how to specify the input raster dataset in the Map Algebra expression of Raster Calculator.
ArcObjects
The output from the ArcObjects method is a raster object.
The output contains integer values that range from 1 to 255. The values for each direction from the center are: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. Cells with undefined flow direction can be flagged as sinks using the Sink method.
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).
If createDrop is set to True, the output 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 values in flat areas, the distance to diagonally adjacent cells (1.414 * cell size) is approximated by 1.5 * cell size to increase the processing speed by using integer calculations.
When the forceFlowAtEdge option is set to True, a cell at the edge of the surfaceRaster 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 surfaceRaster.
| Parameter | Explanation | Datatype |
|---|---|---|
| Input surface raster (Required) |
The input raster representing a continuous surface.
|
Composite Geodataset |
| Output flow direction raster (Required) |
The output raster that shows the flow direction from each cell to its steepest downslope neighbor.
|
Raster Dataset |
| Force all edge cells to flow outward (Optional) |
Specifies if edge cells will always flow outward or follow normal flow rules.
|
Boolean |
| Output drop raster (Optional) |
An optional output drop raster. The drop raster shows 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.
|
Raster Dataset |
# FlowDirection_sample.py
# Description:
# Creates a raster of flow direction from each cell to its
# steepest downslope neighbor.
# Requirements: None
# Author: ESRI
# Date: Sept 6, 2005
# Import system modules
import arcgisscripting
# Create the Geoprocessor object
gp = arcgisscripting.create()
try:
# Set local variables
InSurfaceRaster = "C:/data/filleddem"
OutFlowDirectionRaster = "C:/data/flowdir"
InFlowDirOption = "NORMAL"
# Check out Spatial Analyst extension license
gp.CheckOutExtension("Spatial")
# Process: FlowDirection
gp.FlowDirection_sa(InSurfaceRaster, OutFlowDirectionRaster, InFlowDirOption)
except:
# If an error occurred while running a tool, then print the messages.
print gp.GetMessages()
| Parameter | Explanation |
|---|---|
| <surface_grid> | A raster representing an elevation surface. |
| {o_drop_grid} | An optional output raster showing a 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. |
| {NORMAL | FORCE} | Controls the direction of flow at the edges of the surface raster.
|
flowdirection(elev) flowdirection(elev, drop, force)
| Parameter | Explanation |
|---|---|
| surfaceRaster | A raster representing an elevation surface. |
| createDrop | If the Boolean expression is set to True, an optional output raster will be created showing a 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. |
| forceFlowAtEdge | Controls the direction of flow at the edges of the surface raster. If the Boolean expression is set to True and 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. If set to False, all cells at the edge of the surface will flow outward from the surface. |
' Create the RasterHydrologyOp object
Dim pHydrologyOp As IHydrologyOp
Set pHydrologyOp = New RasterHydrologyOp
' Declare the input surface raster object
Dim pSurfaceDataset As IGeoDataset
' Calls function to open a raster dataset from disk
Set pSurfaceDataset = OpenRasterDataset("D:\SpatialData", "surfaceras")
' Declare the output raster object
Dim pOutputRaster As IGeoDataset
' Calls the method
Set pOutputRaster = pHydrologyOp.FlowDirection (pSurfaceDataset, True, True)