Skip To Content
ArcGIS Developer

Derive Stream As Raster


Example applications of DeriveStreamAsRaster 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 stream image service that will be created.

You can specify the name, or you can create an empty service using Portal Admin Sharing API and use the return JSON object as input to this parameter.

Syntax: A JSON object describes the name of the output or the output raster.

Output name example:


Output raster examples:

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

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

//Output raster layer service:
"outputStreamRasterName":{"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 edge cells will always flow outward or follow normal flow rules.

Syntax: A Boolean value as either false or true.

  • false—If the maximum drop on the inside of an edge cell is greater than zero, the flow direction will be determined as usual. Otherwise, the flow direction will be toward the edge. Cells that should flow from the edge of the surface to the raster inward will do so. This is the default.
  • true—All cells at the edge of the surface raster will flow outward from the surface raster.

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>/DeriveStreamAsRaster/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>/DeriveStreamAsRaster/jobs/<jobId>/results/<output parameter>

Example usage

The example below is a sample request URL for DeriveStreamAsRaster.

JSON Response example

The response returns the outputStreamRaster 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": "outputStreamRaster",
  "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.