Stream to Feature

Converts a raster representing a linear network to features representing the linear network.

Learn more about how Stream to Feature works


Usage tips

Command line and Scripting

ArcObjects

Syntax

StreamToFeature_sa (in_stream_raster, in_flow_direction_raster, out_polyline_features, simplify)
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 can be created with the Flow Direction function.

Composite Geodataset
Output polyline features (Required)

Output feature class that will hold the converted streams.

Feature Class
Simplify polylines (Optional)

Specifies whether weeding is used.

  • SIMPLIFY — The feature is weeded to reduce the number of vertices. The Douglas-Puecker algorithm for line generalization is used, with a tolerance of sqrt(0.5) * cell size.

  • NO_SIMPLIFY — No weeding is applied.

By default, weeding is applied.

Boolean
Data types for geoprocessing tool parameters

Script Example

# StreamToFeature_sample.py
# Description: 
#   Converts a raster representing a linear network to features
#   representing the linear network. 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"
    OutPolylineFeatures = "C:/data/streamfeature.shp"
    InGeneralizeOption = "NO_SIMPLIFY"

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

    # Process: StreamToFeature
    gp.StreamToFeature_sa(InStreamRaster, InFlowDirectionRaster, OutPolylineFeatures, InGeneralizeOption)

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

Map Algebra syntax

See StreamShape


ArcObjects syntax

IHydrologyOp::StreamToFeature (streamRaster As IGeoDataset, directionRaster As IGeoDataset, performWeeding as Boolean) 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.
performWeeding A Boolean that indicates whether weeding will be performed. The default is False, so weeding is not applied.

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.StreamToFeature (pInputStream, pDirection, True)

See Also

  • Stream Link
  • Stream Order
  • An overview of the Hydrology tools