Flow Direction (Spatial Analyst)
Summary
Creates a raster of flow direction from each cell to its steepest downslope neighbor.
Illustration
Usage
-
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 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 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.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.
Syntax
Parameter | Explanation | Data Type |
in_surface_raster |
The input raster representing a continuous surface. | Raster Layer |
force_flow (Optional) |
Specifies if edge cells will always flow outward or follow normal flow rules.
| Boolean |
out_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 |
Return Value
Name | Explanation | Data Type |
out_flow_direction_raster |
The output raster that shows the flow direction from each cell to its steepest downslope neighbor. | Raster |
Code Sample
This example creates a 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")
This example creates a 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 # Author: ESRI # 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" # Check out the ArcGIS Spatial Analyst extension license arcpy.CheckOutExtension("Spatial") # Execute FlowDirection outFlowDirection = FlowDirection(inSurfaceRaster, "FORCE", outDropRaster) # Save the output outFlowDirection.save("C:/sapyexamples/output/outflowdir02")