Stream Link

Assigns unique values to sections of a raster linear network between intersections.

Learn more about how Stream Link works


Usage tips

Command line and Scripting

Map Algebra

ArcObjects

Syntax

StreamLink_sa (in_stream_raster, in_flow_direction_raster, out_raster)
Parameter Explanation Datatype
Input stream raster (Required)

An input raster that represents a linear stream network.

Composite Geodataset
Input flow direction raster (Required)

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

This is created with the Flow Direction function.

Composite Geodataset
Output raster (Required)

The output stream link raster.

Raster Dataset
Data types for geoprocessing tool parameters

Script Example

# StreamLink_sample.py
# Description: Assigns unique values to sections of a raster linear network between intersections.
# Requirements: None
# Author: ESRI
# Date: Sept 6, 2005

# Import system modules
import arcgisscripting

# Create the Geoprocessor object
gp = arcgisscripting.create()

try:
    # Set local variables
    InStreamRaster = "C:/data/stream"
    InFlowDirectionRaster = "C:/data/flowdir"
    OutRaster = "C:/data/streamlink"

    # Check out Spatial Analyst extension license
    gp.CheckOutExtension("Spatial")

    # Process: StreamLink
    gp.StreamLink_sa(InStreamRaster, InFlowDirectionRaster, OutRaster)

except:
    # If an error occurred while running a tool, then print the messages.
    print gp.GetMessages()

Map Algebra syntax

StreamLink(<net_grid>, <dir_grid>)

Parameter Explanation
<net_grid> A raster representing a linear stream network.
<dir_grid> A raster showing direction of flow out of each cell. This can be created using the FlowDirection function.

Map Algebra example

streamlink(channel_grid, flow_dir)
streamlink(channel_grid, flowdirection(elev))

ArcObjects syntax

IHydrologyOp::StreamLink (streamRaster As IGeoDataset, directionRaster As IGeoDataset) As IGeoDataset

Parameter Explanation
streamRaster An input Raster, RasterDataset, RasterBand, or RasterDescriptor representing a linear stream network.
directionRaster An input Raster, RasterDataset, RasterBand, or RasterDescriptor showing the direction of flow out of each cell. This can be created using the IHydrologyOp::FlowDirection method.

ArcObjects example

' Create the RasterHydrologyOp object
Dim pHydrologyOp As IHydrologyOp
Set pHydrologyOp = New RasterHydrologyOp

' Declare the input stream raster object
Dim pInputStream As IGeoDataset

' Calls function to open a raster dataset from disk
Set pInputStream = OpenRasterDataset ("D:\SpatialData", "inputstream")

' Declare the input direction raster object
Dim pDirection As IGeoDataset

' Calls function to open a raster dataset from disk
Set pDirection = OpenRasterDataset ("D:\SpatialData", "direction")

' Declare the output raster object
Dim pOutputRaster As IGeoDataset

' Calls the method
Set pOutputRaster = pHydrologyOp.StreamLink (pInputStream, pDirection)

See Also

  • Stream Order
  • Stream to Feature
  • Flow Accumulation
  • An overview of the Hydrology tools