Show Navigation | Hide Navigation
You are here:
Extensions > Spatial Analyst > The Raster Calculator

Flow Direction

Release 9.1
Last modified March 26, 2007
E-mail This Topic Printable Version Give Us Feedback

Print all topics in : "The Raster Calculator"


Related Topics

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

Usage tips

Command line syntax
Introducing geoprocessing methods—Using dialog boxes and the command line
FlowDirection_sa <in_surface_raster> <out_flow_direction_raster> {NORMAL | FORCE} {out_drop_raster}

Parameter Explanation
<in_surface_raster>

Input surface raster.

<out_flow_direction_raster>

Output flow direction raster dataset.

{NORMAL | FORCE}

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.

  • FORCE — All cells at the edge of the surface raster will flow outward from the surface raster.

{out_drop_raster}

Output drop raster dataset.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.


Command line example
FlowAccumulation_sa C:/data/filleddem C:/data/flowdir NORMAL

Scripting syntax
Introducing geoprocessing methods—Running a script
FlowDirection_sa (in_surface_raster, out_flow_direction_raster, force_flow, out_drop_raster)

Parameter Explanation
in_surface_raster (Required)

Input surface raster.

out_flow_direction_raster (Required)

Output flow direction raster dataset.

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.

  • FORCE — All cells at the edge of the surface raster will flow outward from the surface raster.

out_drop_raster (Optional)

Output drop raster dataset.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.


Script example
# FlowDirection_sample.py
# Description: Creates a raster of flow direction from each cell to its steepest downslope neighbor.
# Requirements: None
# Author: ESRI
# Date: 12/01/03

# Import system modules
import sys, string, os, win32com.client

# Create the Geoprocessor object
gp = win32com.client.Dispatch("esriGeoprocessing.GpDispatch.1")

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:
# Print error message if an error occurs
    gp.GetMessages()

Map Algebra syntax
FlowDirection(<surface_grid>, {o_drop_grid}, {NORMAL | FORCE})

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 percents.
{NORMAL | FORCE} Controls the direction of flow at the edges of the surface raster.

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

  • FORCE — All cells at the edge of the surface raster will flow outward from the surface raster.

Map Algebra example

flowdirection(elev)
flowdirection(elev, drop, force)

ArcObjects syntax
IHydrologyOp::FlowDirection (surfaceRaster As IGeoDataset, createDrop As Boolean, forceFlowAtEdge As Boolean) As IGeoDataset

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

ArcObjects example

' 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", "surfaceraster")

' Declare the output raster object	
Dim pOutputRaster As IGeoDataset

' Calls the method
Set pOutputRaster = pHydrologyOp.FlowDirection (pSurfaceDataset, True, True)

Please visit the Feedback page to comment or give suggestions on ArcGIS Desktop Help.
Copyright © Environmental Systems Research Institute, Inc.