Flow Direction |
|
Release 9.1
Last modified March 26, 2007 |
Print all topics in : "The Raster Calculator" |
Creates a raster of flow direction from each cell to its steepest downslope neighbor.
Learn more about how Flow Direction works
Illustration
Usage tips
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.
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 percents. 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.
When typing a Map Algebra expression into the ArcGIS Spatial Analyst Raster Calculator, if the input raster dataset is a grid and resides in the working directory (set on the General tab of the Options dialog box), type the name of the grid directly into the expression, for example, slope(ingrid1).
If the grid dataset does not reside in your working directory, type the path to the grid dataset on disk, for example, slope(c:\SpatialData\ingrid1).
All other raster datasets (for example, TIFF) cannot be accessed directly from disk. To input other raster data (including grids) into an expression, you must first add the dataset as a layer to ArcMap. The layers will be displayed in the Layers list of the Raster Calculator. When entering the raster into a Map Algebra expression, it must be surrounded by square brackets, for example, slope([inlayer1]).
ArcObjects
The output from the ArcObject method is a raster object.
The output contains integer values which 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 percents. 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.
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.
|
{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. |
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.
|
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. |
# 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.
|
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. |
' 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)