Skip To Content

Trace Downstream

Trace Downstream

The Trace Downstream task determines the trace, or flow path, in a downstream direction from the points in your analysis layer.

For example, suppose you have point features representing sources of contamination and you want to determine where in your study area the contamination will flow. You can use Trace Downstream to identify the path the contamination will take. This trace can also be divided into individual line segments by specifying a distance value and units. The line being returned can be the total length of the flow path, a specified maximum trace length, or clipped to area features such as your study area. In many cases, if the total length of the trace path is returned, it will be from the source all the way to the ocean.

Request URL

http://<analysis url>/TraceDownstream/submitJob

Request Parameters

ParameterDescription

inputLayer

(Required)

The point features used for the starting location of a downstream trace.

Syntax: As described in detail in the Feature input topic, this parameter can be one of the following:

  • A URL to a feature service layer with an optional filter to select specific features
  • A feature collection

Examples:

  • {"url": <feature service layer url>, "filter": <where clause>}
  • {"layerDefinition": {}, "featureSet": {}, "filter": <where clause>}

splitDistance

The trace line will be split into multiple lines where each line is of the specified length. The resulting trace will have multiple line segments, each with fields FromDistance and ToDistance.

  • Type: Double

splitUnits

The units used to specify split distance.

  • Type: String

  • Values: Meters | Kilometers | Feet | Yards | Miles

  • Default: Kilometers

maxDistance

Determines the total length of the line that will be returned. If you provide a boundingPolygonLayer to clip the trace, the result will be clipped to the features in boundingPolygonLayer, regardless of the distance you enter here.

  • Type: Double

maxDistanceUnits

The units used to specify maximum distance.

  • Type: String

  • Values: Meters | Kilometers | Feet | Yards | Miles

  • Default: Kilometers

boundingPolygonLayer

A polygon layer specifying the area(s) where you want the trace downstreams to be calculated in. For example, if you only want to calculate the trace downstream with in a county polygon, provide a layer containing the county polygon and the resulting trace lines will be clipped to the county boundary.

Syntax: As described in detail in the Feature input topic, this parameter can be one of the following:

  • A URL to a feature service layer with an optional filter to select specific features
  • A feature collection

sourceDatabase

Keyword indicating the data source resolution that will be used in the analysis.

  • Type: String

  • Values: The values for this parameter are:

    • Finest (Default): Finest resolution available at each location from all possible data sources.

    • 30m: The hydrologic source was built from 1 arc second - approximately 30 meter resolution, elevation data.

    • 90m: The hydrologic source was built from 3 arc second - approximately 90 meter resolution, elevation data.

generalize

Determines if the output trace downstream lines will be smoothed into simpler lines or conform to the cell edges of the original DEM.

  • Type: Boolean

  • Values:

    • True: The polygons will be smoothed into simpler shapes. This is the default.

    • False: The edge of the polygons will conform to the edges of the original DEM.

outputName

If provided, the task will create a feature service of the results. You define the name of the service. If an outputName value is not provided, the task will return a feature collection.

Syntax:

{
  "serviceProperties": {
    "name": "<service name>"
  }
}
In ArcGIS Online or ArcGIS Enterprise 10.9.1 and later, you can overwrite an existing feature service by providing the itemId value of the existing feature service and setting the overwrite property to True. Including the serviceProperties parameter is optional. As described in the Feature output topic, you must either be the owner of the feature service or have administrative privileges to perform the overwrite.

Syntax:

{

  "itemProperties": {
			"itemId": "<itemID of the existing feature service>",
			"overwrite": True
	}
}
or
{
"serviceProperties": {
    "name": "<existing service name>"
  },
"itemProperties": {
				"itemId": "<itemID of the existing feature service>",
				"overwrite": True
	}
}

context

The Context parameter contains the following additional settings that affect task operation:

  • Extent (extent)—A bounding box that defines the analysis area. Only input features that intersect the bounding box will be analyzed.
  • Output spatial reference (outSR)—The output features will be projected into the output spatial reference.

Syntax:

{
"extent" : {extent},
"outSR" : {spatial reference}
}

f

The response format. The default response format is html.

Values: html | json

Response

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

Syntax:

{
"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 the topic Checking job status. Once the job has successfully completed, use the jobId to retrieve the results. To track the status, you can make a request of the following form:

http://<analysis url>/TraceDownstream/jobs/<jobId>

Accessing results

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:

http://<analysis url>/TraceDownstream/jobs/<jobId>/results/traceLayer?token=yourToken&f=json

ParameterDescription

traceLayer

(Required)

These are line features which are the trace lines, or trace line segments, from the input points.

The resultant line features have the attributes from the input points as well the following attributes:

  • PourPtID—The unique ID field from the input points feature
  • Description— Describes the source database used in the analysis. US30m-which is derived from the 30m NHDPlusV2.1 for the continental United States, and the 90m HydroSHEDS for the world between 60 degrees North and 56 degrees South, plus some areas in Canada and Alaska north of 60 degrees.
  • DataResolution— The data-source resolution that was be used in the analysis
  • AnalysisLength—The length of the line in the units specified in your analysis. If units are not specified on the tool then the units in your profile, which will either be miles or kilometers are used.

If line segments are calculated there will be three additional attributes:

  • FromDistance— Is how far down the trace each trace segment starts. The first from distance for each trace is always zero because the first trace segment starts at the origin of the trace.
  • ToDistance— Is how far down the trace each trace segment stops. The last segment in a trace will have a to distance the equals the total distance.
  • TotalDistance— Is the total distance of a trace. If max distance is specified then this will be the total distance.

Request example:
{"url": 
"http://<analysis url>/TraceDownstream/jobs/<jobId>/results/traceLayer"}

The result has properties for parameter name, data type, and value. The contents of value depend on the outputName parameter provided in the initial request.

  • If outputName was provided, value contains the URL to the feature service layer.
    
    {
      "paramName":"traceLayer", 
      "dataType":"GPString",
      "value":{"url":"<hosted featureservice layer url>"}
    }
  • If outputName was not provided, value contains a feature collection.
    
    {
      "paramName":"traceLayer",
      "dataType":"GPString",
      "value":{"layerDefinition": {}, "featureSet": {}  }
    }

See Feature Output for more information about how the result layer or collection is accessed.