Summary
Calculates the upstream (or downstream) distance or weighted distance of the flow path along each cell.
Usage
· Water flow length The value type of the output raster is floating-point.
· The main purpose of the flow length tool is to calculate the length of the longest flow in a given basin. This measure is often used to calculate the aggregation time of a basin. This can be done using the upstream option.
The tool can also create a distance-area chart of hypothetical rainfall and runoff events by using the weighted raster as the impedance for downhill motion.
Grammar
Flowlength (In_flow_direction_raster, {direction_measurement}, {in_weight_raster})
Code instance
Flow Length (Flowlength) Example 1 (Python window)
This example calculates the downstream distance along the flow path for each cell.
Import arcpy
From arcpy Import env
From ARCPY.SA Import *
Env.workspace = "C:/sapyexamples/data"
Outflowlength = Flowlength ("Flowdir", "downstream", "" ")
Outflowlength.save ("C:/sapyexamples/output/outflowlen01")
Flow Length (Flowlength) Example 2 (stand-alone script)
This example calculates the downstream distance along the flow path for each cell.
# Name: _ex_02.py
# Description:
# 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
Inflowdirectionraster = "Flowdir"
Inweightraster = ""
Directiontype = "Downstream"
# Check out the ArcGIS Spatial Analyst extension License
arcpy. Checkoutextension ("Spatial")
# Execute
Outflowlength = Flowlength (Inflowdirectionraster, Directiontype, Inweightraster)
# Save the output
Outflowlength.save ("C:/sapyexamples/output/outflowlen02.tif")
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
ArcGIS Tutorial: Water flow length