Flow Distance (Raster Analysis)

Summary

Computes, for each cell, the horizontal or vertical component of downslope distance, following the flow paths, to cells on a stream into which they flow. In the case of multiple flow paths, minimum, weighted mean, or maximum flow distance can be computed.

If an optional flow direction raster is provided, the down slope directions will be limited to those defined by the input flow direction raster.

Illustration

Flow Distance tool illustration

Usage

  • This raster analysis portal tool is available when you are signed in to an ArcGIS Enterprise Link to Understanding analysis in ArcGIS Enterprise portal that has an ArcGIS Image Server Link to What is ArcGIS Image Server configured for Raster Analysis Link to Configure and deploy raster analytics. When the tool is invoked, ArcGIS Pro serves as a client and the processing occurs in the servers federated with ArcGIS Enterprise. The portal tool accepts layers from your portal as input and creates output in your portal.

    The input raster layer supports a layer from the portal, a URI or URL to an image service, or the output from the Make Image Server Layer tool. This tool does not support local raster data or layers.

  • To limit downslope directions along which flow distance is measured, provide an optional input flow direction raster that can be derived using the Flow Direction tool. Choose from D8, D-Infinity (DINF) and multi flow direction (MFD) flow models while generating an optional input flow direction raster. Use the Input flow direction type to specify which method was used when the flow direction raster was created.

  • If an optional input flow direction raster is provided, it is recommended that this raster be created using the Flow Direction tool using the same input surface raster that you'll provide to the Flow Distance tool.

    If this input surface raster is void of sinks, the distance measurements will be to stream cells represented by the input stream raster.

    If this input surface raster has sinks present, some flow paths can be terminated short by them flowing into sinks before reaching streams. In such cases, flow distance measurements for these cells are calculated only up to the sink cells into which they flow.

  • When the tool is run without an optional flow direction raster, flow distance is assessed by considering all possible downslope flow paths from each cell to cell(s) on a stream into which they flow.

    When the tool is run with an optional D8 flow direction raster, there is only one possible downslope flow path from every cell to a cell on the stream, and flow distance is measured along this single flow path.

  • It is recommended to create the input stream raster using the same input surface raster that is provided as input to the tool. If you have a Spatial Analyst extension license available, you can create stream rasters from an input surface raster using the Flow Direction, Flow Accumulation and Con tools respectively. If you wish to use streams from other data sources, for best results, you would have to burn them into the input surface raster first and then running the Flow Distance tool.

  • When multiple flow paths exist from each cell to cells on the stream into which they flow, use the Statistics type to compute minimum, weighted mean, or maximum flow distance.

    If there exists only a single flow path from each cell to a cell on the stream, all statistics types produce the same result.

Syntax

arcpy.ra.FlowDistance(inputStreamRaster, inputSurfaceRaster, outputName, {inputFlowDirectionRaster}, {distanceType}, {flowDirectionType}, {statisticsType})
ParameterExplanationData Type
inputStreamRaster

The input raster that defines the stream network.

Raster Layer; Image Service; String
inputSurfaceRaster

The input raster representing a continuous surface.

Raster Layer; Image Service; String
outputName

The name of the output flow distance raster service.

The default name is based on the tool name and the input layer name. If the layer name already exists, you will be prompted to provide another name.

String
inputFlowDirectionRaster
(Optional)

The input raster that shows the direction of flow out of each cell.

When a flow direction raster is provided, the down slope direction(s) will be limited to those defined by the input flow directions.

The flow direction raster can be created using the D8, MFD, or DINF method. Use the flowDirectionType parameter to specify the method used when the flow direction raster was created.

Raster Layer; Image Service; String
distanceType
(Optional)

The distance type to be calculated.

  • VERTICALThe flow distance calculations represent the vertical component of minimum flow distance, following the flow path, from each cell in the domain to cell(s) on the stream into which they flow. This is the default.
  • HORIZONTALThe flow distance calculations represent the horizontal component of minimum flow distance, following the flow path, from each cell in the domain to cell(s) on the stream into which they flow.
String
flowDirectionType
(Optional)

Specifies the input flow direction raster type.

  • D8The input flow direction raster is of type D8. This is the default.
  • MFDThe input flow direction raster is of type Multi Flow Direction (MFD).
  • DINFThe input flow direction raster is of type D-Infinity (DINF).
String
statisticsType
(Optional)

Determines the statistics type used to compute flow distance over multiple flow paths.

If there exists only a single flow path from each cell to a cell on the stream, all statistics types produce the same result.

  • MINIMUMWhere multiple flow paths exist, minimum flow distance is computed. This is the default.
  • WEIGHTED_MEANWhere multiple flow paths exist, a weighted mean of flow distance is computed. Flow proportion from a cell to its downstream neighboring cells is used as a weight for computing weighted mean.
  • MAXIMUMWhen multiple flow paths exist, maximum flow distance is computed.
String

Derived Output

NameExplanationData Type
outputRaster

The output raster.

Raster Layer

Code sample

FlowDistance example 1 (Python window)

This example calculates the minimum downslope horizontal flow distance to a cell on the stream raster.

import arcpy
arcpy.FlowDistance_ra("https://myserver/rest/services/streams/ImageServer","https://myserver/rest/services/elevation_fill/ImageServer","outFlowDistanceVertical1")
FlowDistance example 2 (stand-alone script)

This example calculates the minimum downslope vertical flow distance to a cell on the stream raster.

#---------------------------------------------------------------------------
# Name: FlowDistance_example02.py
# Requirements: ArcGIS Image Server

# Import system modules
import arcpy

# Set local variables
inStreams = "https://myserver/rest/services/streams/ImageServer"
inSurface = "https://myserver/rest/services/elevation_fill/ImageServer"
outputFlowDistance = "outFlowDistanceVertical2"
inFlowDirection = ""
distanceType = "VERTICAL"

# Execute Flow Distance raster analysis tool
arcpy.FlowDistance_ra(inStreams, inSurface, outputFlowDistance, inFlowDirection, distanceType)

Licensing information

  • Basic: Requires ArcGIS Image Server
  • Standard: Requires ArcGIS Image Server
  • Advanced: Requires ArcGIS Image Server

Related topics