ArcGIS for Desktop

  • Documentation
  • Pricing
  • Support

  • My Profile
  • Help
  • Sign Out
ArcGIS for Desktop

ArcGIS Online

The mapping platform for your organization

ArcGIS for Desktop

A complete professional GIS

ArcGIS for Server

GIS in your enterprise

ArcGIS for Developers

Tools to build location-aware apps

ArcGIS Solutions

Free template maps and apps for your industry

ArcGIS Marketplace

Get apps and data for your organization

  • Documentation
  • Pricing
  • Support
Esri
  • Sign In
user
  • My Profile
  • Sign Out

Help

  • Home
  • Get Started
  • Map
  • Analyze
  • Manage Data
  • Tools
  • More...

Flow Direction

Available with Spatial Analyst license.

  • Summary
  • Illustration
  • Usage
  • Syntax
  • Code Sample
  • Environments
  • Licensing Information

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

  • 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 the following:

    Flow Direction codes

    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.41421 * cell size) is approximated by 1.5 * cell size for improved performance.

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

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

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

Return Value

NameExplanationData Type
out_flow_direction_raster

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

This output is of integer type.

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

# 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

  • Auto Commit
  • Cell Size
  • Compression
  • Current Workspace
  • Extent
  • Geographic Transformations
  • Mask
  • Output CONFIG Keyword
  • Output Coordinate System
  • Raster Statistics
  • Scratch Workspace
  • Snap Raster
  • Tile Size

Licensing Information

  • ArcGIS for Desktop Basic: Requires Spatial Analyst
  • ArcGIS for Desktop Standard: Requires Spatial Analyst
  • ArcGIS for Desktop Advanced: Requires Spatial Analyst

Related Topics

  • An overview of the Hydrology toolset
Feedback on this topic?

ArcGIS for Desktop

  • Home
  • Documentation
  • Pricing
  • Support

ArcGIS Platform

  • ArcGIS Online
  • ArcGIS for Desktop
  • ArcGIS for Server
  • ArcGIS for Developers
  • ArcGIS Solutions
  • ArcGIS Marketplace

About Esri

  • About Us
  • Careers
  • Insiders Blog
  • User Conference
  • Developer Summit
Esri
© Copyright 2016 Environmental Systems Research Institute, Inc. | Privacy | Legal