Skip To Content
ArcGIS Developer

Derive Stream As Line


Example applications of DeriveStreamAsLine include the following:

  • Extract streams from a DEM.
  • Consider sink or depression cell locations through the inputDepressionsData parameter in the extraction of streams and determine flow accumulation at each cell of the surface raster, allowing water flow into depression locations but not outward.

Request parameters



The input raster representing a surface.

Syntax: This parameter can be specified as a portal item ID, a URL to a raster image service layer, a cloud raster dataset, or a shared raster dataset.


//Portal item as input raster
"inputSurfaceRaster": {"itemId": <portal item id>}

//URL as input raster
"inputSurfaceRaster": {"url": <image service layer url>}


The name of the output feature service that will contain the stream features.

The task will create a feature service of the results. You can define the name of the service.

Output name example:


Output raster examples:

//Output portal item:
"outputStreamFeaturesName":{"itemId": <portal item id>}

//Output url:
"outputStreamFeaturesName":{"url": <image service url>}

//Output raster layer service:
"outputStreamFeaturesName":{"service properties":
  "serviceUrl":"https://<server name>/server/rest/services/Hosted/testrasteranalysis/ImageServer",

An optional dataset that defines real depressions.

The depressions can be defined through a raster or a feature layer.

If the input is a raster, the depression cells must take a valid value, including zero, and the areas that are not depressions must be NoData.

Raster input example:

"inputDepressionsData":{"url": <image service layer url>}

Feature input examples:

//Feature layer URL
"inputDepressionsData":{"url": <feature service layer url>}

//Feature collection
"inputDepressionsData":{"layerDefinition": {}, "featureSet": {}}


An optional input raster dataset that defines the fraction of flow that contributes to flow accumulation at each cell.

The weight is only applied to the accumulation of flow.

If no accumulation weight raster is specified, a default weight of 1 will be applied to each cell.


"inputWeightRaster":{"url": <image service layer url>}


The threshold for determining whether a given cell is part of a stream in terms of the total area that flows into such cell.


Specifies the method that will be used to assign a unique value of stream sections between intersections or an order to the segments of streams in the output.

  • CONSTANT—The output cell values will all equal 1. This is the default.
  • UNIQUE—Each stream will have a unique ID between intersections in the output.
  • STRAHLER—The Strahler method, in which stream order only increases when streams of the same order intersect, will be used. The intersection of a first-order and second-order link will remain a second-order link, rather than creating a third-order link.
  • SHREVE—The Shreve method, in which stream order is assigned by magnitude, will be used. All links with no tributaries are assigned a magnitude (order) of 1. Magnitudes are additive downslope. When two links intersect, their magnitudes are added and assigned to the downslope link.
  • HACK—The Hack method, in which each stream segment is assigned an order greater than the stream or river to which it discharges, will be used. For example, the main river channel is assigned an order of 1, all stream segments discharging to it are assigned an order of 2, any stream discharging to an order 2 stream is assigned an order of 3, and so on.

Specifies whether the output stream lines will be smoothed into simpler shapes.

Syntax: A Boolean value as either true or false.

  • A value of true specifies that the stream feature lines will be simplified using the Douglas-Peucker algorithm with a tolerance of sqrt(0.5) * cell size. This is the default.
  • A value of false specifies that the stream feature lines will not be smoothed.

Contains additional settings that affect task execution. This task has the following settings:

  • Extent (extent): A bounding box that defines the analysis area.
  • Output Spatial Reference (outSR): The output raster will be projected into the output spatial reference.
  • Snap Raster (snapRaster): The output raster will have its cells aligned with the specified snap raster.
  • Cell Size (cellSize): The output raster will have the resolution specified by cell size.
  • Mask (mask): Only cells that fall within the analysis mask will be considered in the operation.

The response format. The default response format is html.

Values: html | json | pjson


When you submit a request, the task assigns a unique job ID for the transaction.

  "jobId": "<unique job identifier>",
  "jobStatus": "<job status>"

After the initial request is submitted, you can use the jobId to periodically check the status of the job and messages as described in Checking job status. Once the job has successfully completed, you use the jobId to retrieve the results. To track the status, you can make a request of the following form:

https://<raster analysis tools url>/DeriveStreamAsLine/jobs/<jobId>

When the status of the job request is esriJobSucceeded, you can access the results of the analysis by making a request of the following form:

https://<raster analysis tools url>/DeriveStreamAsLine/jobs/<jobId>/results/<output parameter>

Example usage

The example below is a sample request URL for DeriveStreamAsLine.

JSON Response example

The response returns the outputStreamFeatures output parameter, which has properties for parameter name, data type, and value. The content of value is the output raster dataset itemId value and the image service URL.

  "paramName": "outputStreamFeatures",
  "dataType": "GPString",
  "value": {
    "itemId": "f121390b85ef419790479fc75b493efd",
    "url": "https://<server name>/arcgis/rest/services/Hosted/<service name>/ImageServer"


  • Hack, J. T. 1957. "Studies of Longitudinal Stream Profiles in Virginia and Maryland." Geological Survey Professional Paper 294: 45–95.

  • Metz, M., Mitasova, H., & Harmon, R. S. 2011. "Efficient extraction of drainage networks from massive, radar-based elevation models with least cost path search." Hydrology and Earth System Sciences 15(2): 667-678.