Stream Link (Spatial Analyst)
Summary
Assigns unique values to sections of a raster linear network between intersections.
Usage
- Links are the sections of a stream channel connecting two successive junctions, a junction and the outlet, or a junction and the drainage divide.  Illustration of the links in a stream channel Illustration of the links in a stream channel
- 
The input stream raster can be created by "thresholding" the results of the Flow Accumulation tool. 
- 
The stream raster linear network should be represented as values greater than or equal to one on a background of NoData. 
Syntax
| Parameter | Explanation | Data Type | 
| in_stream_raster | An input raster that represents a linear stream network. | Raster Layer | 
| in_flow_direction_raster | The input raster that shows the direction of flow out of each cell. The flow direction raster can be created using the Flow Direction tool. | Raster Layer | 
Return Value
| Name | Explanation | Data Type | 
| out_raster | The output stream link raster. It will be of integer type. | Raster | 
Code Sample
This example assigns unique values to sections of a raster linear network between intersections.
import arcpy
from arcpy import env
from arcpy.sa import *
env.workspace = "C:/sapyexamples/data"
outStreamLink = StreamLink("stream", "flowdir")
outStreamLink.save("c:/sapyexamples/output/outstrmlnk01")
This example assigns unique values to sections of a raster linear network between intersections.
# 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
inStreamRaster = "stream"
inFlowDirection = "flowdir"
# Check out the ArcGIS Spatial Analyst extension license
arcpy.CheckOutExtension("Spatial")
# Execute StreamLink
outStreamLink = StreamLink(inStreamRaster, inFlowDirection)
# Save the output 
outStreamLink.save("c:/sapyexamples/output/outstrmlnk02")