Flow Direction (Spatial Analyst)

Summary

Creates a raster of flow direction from each cell to its steepest downslope neighbor.

Learn more about how Flow Direction works

Illustration

Flow Direction illustration
Flow_Dir = FlowDirection(Elev_Ras)

Usage

Syntax

FlowDirection (in_surface_raster, {force_flow}, {out_drop_raster})
ParameterExplanationData 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.

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

NameExplanationData Type
out_flow_direction_raster

The output raster that shows the flow direction from each cell to its steepest downslope neighbor.

Raster

Code Sample

FlowDirection example 1 (Python window)

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")
FlowDirection example 2 (stand-alone script)

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")

Environments

Related Topics

Licensing Information

ArcView: Requires Spatial Analyst
ArcEditor: Requires Spatial Analyst
ArcInfo: Requires Spatial Analyst

6/29/2011