Stream Link (Spatial Analyst)

Available with Spatial Analyst license.

Summary

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

Illustration

Stream Link tool illustration

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.

    Links in a stream channel illustration
    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.

  • The Stream Link tool only supports a D8 input flow direction raster. D8 flow directions can be created using the Flow Direction tool, run with default flow direction type D8.

  • This tool supports parallel processing. If your computer has multiple processors or processors with multiple cores, better performance may be achieved, particularly on larger datasets. The Parallel processing with Spatial Analyst help topic includes details on this capability and how to configure it.

    When using parallel processing, temporary data will be written to manage the data chunks being processed. The default temp folder location will be on your local C: drive. You can control the location of this folder by setting up a system environment variable named TempFolders and specifying the path to a folder to use (for example, E:\RasterCache). If you have administrator privileges on your machine, you can also use a registry key (for example, [HKEY_CURRENT_USER\SOFTWARE\ESRI\ArcGISPro\Raster]).

    By default, this tool will use 50 percent of the available cores. If the input data is smaller than 5,000 by 5,000 cells in size, fewer cores might be used. You can control the number of cores the tool uses with the Parallel processing factor environment.

  • See Analysis environments and Spatial Analyst for additional details on the geoprocessing environments that apply to this tool.

Parameters

LabelExplanationData Type
Input stream raster

An input raster that represents a linear stream network.

Raster Layer
Input 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, run using the default flow direction type D8.

Raster Layer

Return Value

LabelExplanationData Type
Output raster

The output stream link raster.

This output is of integer type.

Raster

StreamLink(in_stream_raster, in_flow_direction_raster)
NameExplanationData 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, run using the default flow direction type D8.

Raster Layer

Return Value

NameExplanationData Type
out_raster

The output stream link raster.

This output is of integer type.

Raster

Code sample

StreamLink example 1 (Python window)

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")
StreamLink example 2 (stand-alone script)

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"

# Execute StreamLink
outStreamLink = StreamLink(inStreamRaster, inFlowDirection)

# Save the output 
outStreamLink.save("c:/sapyexamples/output/outstrmlnk02")

Licensing information

  • Basic: Requires Spatial Analyst
  • Standard: Requires Spatial Analyst
  • Advanced: Requires Spatial Analyst

Related topics