Distance Accumulation

URL:
https://<root>/<serviceName>/RasterAnalysisTools/GPServer/DistanceAccumulation
Methods:
GET
Version Introduced:
10.8.1

Description

Distance Accumulation diagram

The DistanceAccumulation task calculates accumulated distance for each cell to sources, allowing for straight-line distance, cost distance, and true surface distance, as well as vertical and horizontal cost factors.

The DistanceAccumulation operation calculates straight-line distance or the least accumulative cost distance for each cell to the source over a cost surface, while optionally accounting for the surface distance and the horizontal and vertical factors.

To properly handle the edge of the projection at a global extent when performing distance analysis at a global scale, ensure that either a cylindrical projection or a geographic output coordinate system is used in conjunction with the Geodesic option for the Distance Method parameter.

Example applications include the following:

  • Identify the least expensive route to construct a new road to a proposed school.
  • Connect the best habitat patches for bobcats with wildlife corridors to allow the species to move between the patches.
  • Calculate the actual cost and distance for a proposed road adjusting for the uphill and downhill changes in the landscape.

Request parameters

ParameterDetails

inputSourceRasterOrFeatures

A layer that identifies the locations from or to which the least accumulated cost distance for every output cell location is calculated.

Syntax: This parameter can have either a raster input or a feature input. For raster input, 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. For feature input, this parameter can be specified as either a URL to a feature service layer or a feature collection.

Raster input examples:

Use dark colors for code blocksCopy
1
2
"inputSourceRasterOrFeatures":{"itemID": <portal item ID>}
"inputSourceRasterOrFeature":{"url": <image service layer url>}

Feature input examples:

Use dark colors for code blocksCopy
1
2
3
4
5
//Feature layer URL
"inputSourceRasterOrFeatures":{"url": <feature service layer url>}

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

outputDistanceAccumulationRasterName

The output distance image service name that will be created.

This calculates, for each cell, the accumulative distance to the closest source.

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:

Use dark colors for code blocksCopy
1
"outputDistanceAccumulationRasterName":{"serviceProperties":{"name":"testrasteranalysis"}}

Output raster examples:

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
//Output portal item
"outputDistanceAccumulationRasterName":{"itemId": <portal item id>}

//Output URL
"outputDistanceAccumulationRasterName":{"url": <image service url>}

//Output raster layer service
"outputDistanceAccumulationRasterName":{"serviceProperties":
  {"name":"testrasteranalysis",
    "serviceUrl":"https://<server name>/server/rest/services/Hosted/testrasteranalysis/ImageServer"},
  "itemProperties":{"itemId":"8cfbd3ec25584d0d8f4ed23b8ff7c43b","folderId":"sdfwerfbd3ec25584d0d8f4"}
}

inputBarrierRasterOrFeatures

The dataset that defines the barriers.

The barriers can be defined by an integer or a floating-point raster, or by a feature layer.

For a raster barrier, the barrier must have a valid value, including zero, and the areas that are not barriers must be NoData.

Syntax: This parameter can have either a raster input or a feature input. For raster input, 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. For feature input, this parameter can be specified as either a URL to a feature service layer or a feature collection.

Raster input examples:

Use dark colors for code blocksCopy
1
2
"inputBarrierRasterOrFeatures":{"itemID": <portal item ID>}
"inputBarrierRasterOrFeatures":{"url": <image service layer url>}

Feature input examples:

Use dark colors for code blocksCopy
1
2
3
4
5
//Feature layer URL
"inputBarrierRasterOrFeatures":{"url": <feature service layer url>}

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

inputSurfaceRaster

A raster defining the elevation values at each cell location.

The values are used to calculate the actual surface distance covered when passing between cells.

If the input surface raster has a vertical coordinate system (VCS), the values of the surface raster are considered to be in the units of the VCS. If the input surface raster does not have a VCS and the data is projected, the surface values are considered to be in the linear units of the spatial reference. If the input surface raster does not have a VCS and the data is not projected, the surface values are considered to be in meters.

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.

Examples:

Use dark colors for code blocksCopy
1
2
3
4
5
//Portal item as input raster
"inputSurfaceRaster": {"itemId": <portal item Id>}

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

inputCostRaster

A raster defining the impedance or cost to move planimetrically through each cell.

The values of the cost raster can be integer or floating point. Negative and zero are invalid values but will be treated as very small positive cost values.

Cost raster values that are negative or zero are invalid but will be treated as small positive values. The accumulative cost algorithm is a multiplicative process, and it cannot calculate accumulative cost correctly if cost values are negative or zero. If your cost raster does contain those values, and those locations are to represent areas that should be excluded from the analysis, those cells should be turned into NoData before running the tool. Note that NoData is treated as a barrier in this analysis, so any locations that are NoData in the input will be NoData in the result.

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.

Examples:

Use dark colors for code blocksCopy
1
2
3
4
5
//Portal item as input raster
"inputCostRaster": {"itemId": <portal item id>}

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

inputVerticalRaster

A raster defining the vertical (z) value for each cell.

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.

Examples:

Use dark colors for code blocksCopy
1
2
3
4
5
//Portal item as input raster
"inputVerticalRaster": {"itemId": <portal item id>}

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

verticalFactor

Defines the relationship between the vertical cost factor and the vertical relative moving angle.

There are several factors with modifiers from which to select that identify a defined vertical factor graph. Additionally, a table can be used to create a custom graph. The graphs are used to identify the vertical factor used in calculating the total cost of moving into a neighboring cell.

For each factor, a particular selection of characteristic modifiers will apply. See the section below for details on the factor settings and how to set the characteristic modifiers.

Values: BINARY | LINEAR | SYMMETRIC_LINEAR | INVERSE_LINEAR | SYMMETRIC_INVERSE_LINEAR | COS | SEC | COS_SEC | SEC_COS | HIKING_TIME | BIDIR_HIKING_TIME | TABLE

Characteristics: Zero factor | Low cut angle | High Cut Angle | Slope

Syntax: This parameter is a string.

Examples:

Use dark colors for code blocksCopy
1
2
3
"verticalFactor": "BINARY 1 30"

"verticalFactor": "LINEAR 1 -60 60 0.02"

inputHorizontalRaster

A raster defining the horizontal direction at each cell.

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.

Examples:

Use dark colors for code blocksCopy
1
2
3
4
5
//Portal item as input raster
"inputHorizontalRaster": {"itemId": <portal item Id>}

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

horizontalFactor

Defines the relationship between the horizontal cost factor and the horizontal relative moving angle.

There are several factors with modifiers from which to select that identify a defined horizontal factor graph. Additionally, a table can be used to create a custom graph. The graphs are used to identify the horizontal factor used in calculating the total cost of moving into a neighboring cell.

For each factor, a particular selection of characteristic modifiers will apply. See the Horizontal factor additional information section below for details on the factor settings and how to set the characteristic modifiers.

Values: BINARY | FORWARD | LINEAR | INVERSE_LINEAR | TABLE

Characteristics: Zero factor | Cut angle | Slope | Side value

Syntax: The parameter is a string.

Examples:

Use dark colors for code blocksCopy
1
2
3
"horizontalFactor": "BINARY 1 30"

"horizontalFactor": "LINEAR 1 -60 60 0.02"

outputBackDirectionRasterName

The output back direction image service name that will be created.

The back direction raster contains the calculated direction in degrees. The direction identifies the next cell along the shortest path back to the closest source while avoiding barriers.

The range of values is from 0 degrees to 360 degrees, with 0 reserved for the source cells. Due east (right) is 90, and the values increase clockwise (180 is south, 270 is west, and 360 is north).

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:

Use dark colors for code blocksCopy
1
"outputBackDirectionRasterName":{"serviceProperties":{"name":"testrasteranalysis"}}

Output raster examples:

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
//Output portal item
"outputBackDirectionRasterName":{"itemId": <portal item id>}

//Output URL
"outputBackDirectionRasterName":{"url": <image service url>}

//Output raster layer service
"outputBackDirectionRasterName":{"serviceProperties":
  {"name":"testrasteranalysis",
    "serviceUrl":"https://<server name>/server/rest/services/Hosted/testrasteranalysis/ImageServer"},
  "itemProperties":{"itemId":"8cfbd3ec25584d0d8f4ed23b8ff7c43b","folderId":"sdfwerfbd3ec25584d0d8f4"}
}

outputSourceDirectionRasterName

The source direction raster identifies the direction of the least accumulated cost source cell as an azimuth in degrees.

The range of values is from 0 degrees to 360 degrees, with 0 reserved for the source cells. Due east (right) is 90, and the values increase clockwise (180 is south, 270 is west, and 360 is north).

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:

Use dark colors for code blocksCopy
1
"outputSourceDirectionRasterName":{"serviceProperties":{"name":"testrasteranalysis"}}

Output raster examples:

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
//Output portal item
"outputSourceDirectionRasterName":{"itemId": <portal item id>}

//Output URL
"outputSourceDirectionRasterName":{"url": <image service url>}

//Output raster layer service
"outputSourceDirectionRasterName":{"serviceProperties":
  {"name":"testrasteranalysis",
    "serviceUrl":"https://<server name>/server/rest/services/Hosted/testrasteranalysis/ImageServer"},
  "itemProperties":{"itemId":"8cfbd3ec25584d0d8f4ed23b8ff7c43b","folderId":"sdfwerfbd3ec25584d0d8f4"}
}

outputSourceLocationRasterName

The source location raster is a multiband output. The first band contains a row index, and the second band contains a column index. These indexes identify the location of the source cell that is the least accumulated cost distance away.

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:

Use dark colors for code blocksCopy
1
"outputSourceLocationRasterName":{"serviceProperties":{"name":"testrasteranalysis"}}

Output raster examples:

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
9
10
11
12
//Output portal item
"outputSourceLocationRasterName":{"itemId": <portal item id>}

//Output URL
"outputSourceLocationRasterName":{"url": <image service url>}

//Output raster layer service
"outputSourceLocationRasterName":{"serviceProperties":
  {"name":"testrasteranalysis",
    "serviceUrl":"https://<server name>/server/rest/services/Hosted/testrasteranalysis/ImageServer"},
  "itemProperties":{"itemId":"8cfbd3ec25584d0d8f4ed23b8ff7c43b","folderId":"sdfwerfbd3ec25584d0d8f4"}
}

sourceInitialAccumulation

The starting cost from which to begin the cost calculations.

Syntax: This parameter can be specified as a Double value or as a field.

Examples:

Use dark colors for code blocksCopy
1
2
3
4
5
//Double example
"sourceInitialAccumulation": 2.7

//Field example
"sourceInitialAccumulation": startCost

sourceMaximumAccumulation

Defines the maximum accumulative cost of the traveler from a source.

Syntax: This parameter can be specified as a Double value or as a field.

Examples:

Use dark colors for code blocksCopy
1
2
3
4
5
//Double example
"sourceMaximumAccumulation": 100

//Field example
"sourceMaximumAccumulation": MaximumAccumCost

sourceCostMultiplier

Multiplier to apply to the cost values.

Syntax: This parameter can be specified as a Double value or as a field.

Examples:

Use dark colors for code blocksCopy
1
2
3
4
5
//Double example
"sourceCostMultiplier": 2

//Field example
"sourceCostMultiplier": sourceMult

sourceDirection

Defines the direction of the traveler when applying horizontal and vertical factors and the initial accumulation.

Syntax: A string describing the optimization method, which can be one of the following:

  • FROM_SOURCE —The horizontal factor, vertical factor, and the initial cost accumulation will be applied beginning at the input source and moving out to the nonsource cells. This is the default.

  • TO_SOURCE —The horizontal factor, vertical factor, and the initial cost accumulation will be applied beginning at each nonsource cell and moving back to the input source.

Example:

Use dark colors for code blocksCopy
1
"sourceDirection": "TO_SOURCE"

distanceMethod

Determines whether the distance will be calculated using a planar (flat earth) or a geodesic (ellipsoid) method.

  • PLANAR —The calculation will be performed on a projected flat plane using a 2D Cartesian coordinate system. This is the default.

  • GEODESIC —The calculation will be performed on the ellipsoid. Therefore, regardless of the input or output projection, the results will not change.

Example:

Use dark colors for code blocksCopy
1
"distanceMethod": "GEODESIC"

context

Contains additional settings that affect task processing. 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.

f

The response format. The default response format is html .

Values: html | json | pjson

Horizontal factor additional information

The following section contains details on the available settings and characteristics of the horizontalFactor parameter.

In the explanations below, two acronyms are used: HF stands for horizontal factor, which defines the horizontal difficulty encountered when moving from one cell to the next, and HRMA stands for horizontal relative moving angle, which identifies the angle between the horizontal direction from a cell and the moving direction.

Horizontal factor keywords

KeywordDescription

BINARY

Indicates that if the HRMA is less than the cut angle, the HF is set to the value associated with the zero factor; otherwise, it is set to infinity.

FORWARD

Establishes that only forward movement is allowed. The HRMA must be greater or equal to 0 and less than 90 degrees (0 <= HRMA < 90). If the HRMA is greater than 0 and less than 45 degrees, the HF for the cell is set to the value associated with the zero factor. If the HRMA is greater than or equal to 45 degrees, the side value modifier value is used. The HF for any HRMA equal to or greater than 90 degrees is set to infinity.

LINEAR

Specifies that the HF is a linear function of the HRMA.

INVERSE_LAYER

Specifies that the HF is an inverse linear function of the HRMA.

TABLE

A comma-separated values (CSV) file (.csv ) portal item will be used to define the vertical-factor graph used to determine the HFs

Horizontal factor keyword characteristics

CharacteristicDescription

Zero factor

Establishes the horizontal factor to be used when the HRMA is zero. This factor positions the y-intercept for any of the horizontal factor functions.

Cut angle

Defines the HRMA angle beyond which the HF will be set to infinity.

Slope

Establishes the slope of the straight line used with the LINEAR and INVERSE_LINEAR horizontal factor keywords. The slope is specified as a fraction of rise over run (for example, 45 percent slope is 1/45, which is input as 0.02222).

Side value

Establishes the HF when the HRMA is greater than or equal to 45 degrees and less than 90 degrees when the FORWARD horizontal factor keyword is specified.

Default values

The default values for the horizontal factor characteristics are as follows:

KeywordsZero factorCut angleSlopeSide value
Binary1.045~~
Forward0.545 (fixed)~1.0
Linear0.51811/90~
Inverse linear2.0180-1/90~

Vertical factor additional information

The following section contains details on the available settings and characteristics of the verticalFactor parameter.

In the explanations of the vertical factor keywords below, two acronyms are used: VF stands for vertical factor, which defines the vertical difficulty encountered moving from one cell to the next; and VRMA stands for vertical relative moving angle, which identifies the slope angle between the FROM or processing cell and the TO cell.

Vertical factor keywords

KeywordDescription

BINARY

Indicates that if the VRMA is greater than the low-cut angle and less than the high-cut angle, the VF is set to the value associated with the zero factor; otherwise, it is infinity.

LINEAR

Specifies that the VF is a linear function of the VRMA.

SYMMETRIC_LINEAR

Specifies that the VF is a linear function of th VRMA in either the negative or positive side of the VRMA, respectively, and the two linear functions are symmetrical with respect to the VF (y) axis.

INVERSE_LINEAR

Specifies that the VF is an inverse linear function of the VRMA.

SYMMETRIC_INVERSE_LINEAR

Specifies that the VF is an inverse linear function of the VRMA in either the negative or positive side of the VRMA, respectively, and the two linear functions are symmetrical with respect to the VF (y) axis.

COS

Identifies the VF as the cosine-based function of the VRMA.

SEC

Identifies the VF as the secant-based function of the VRMA.

COS_SEC

Specifies that the VF is the cosine-based function of the VRMA when the VRMA is negative and the secant-based function of the VRMA when the VRMA is nonnegative.

SEC_COS

Specifies that the VF is the secant-based function of the VRMA when the VRMA is negative and the cosine-based function of the VRMA when the VRMA is negative.

HIKING_TIME

Defines the relationship between the vertical cost factor and the vertical relative moving angle through the reciprocal of Tobler's function, which results in hiking time in hours.

BIDIR_HIKING_TIME

Defines the relationship between the vertical cost factor and the vertical relative moving angle through a bidirectional hiking function.

Table

A comma-separated values (CSV) file (.csv ) portal item will be used to define the vertical-factor graph used to determine the VFs.

Vertical factor keyword characteristics

CharacteristicDefinition

Zero factor

Establishes the vertical factor to be used when the VRMA is zero. This factor positions the y-intercept of the specified function. By definition, the zero factor is not applicable to any of the trigonometric vertical functions (COS, SEC, COS-SEC, or SEC-COS). The y-intercept is defined by these functions.

Low cut angle

Defines the VRMA angle below which the VF will be set to infinity.

High cut angle

Defines the VRMA angle above which the VF will be set to infinity.

Slope

Establishes the slope of the straight line used with the LINEAR and INVERSE_LINEAR vertical factor keywords. The slope is specified as a fraction of rise over run (for example, 45 percent slope is 1/45, which is input as 0.02222).

Default values

The default values for the vertical factor characteristics are as follows:

KeywordsZero factorLow cut angleHigh cut angleSlopePowerCos powerSec power
Binary1.0-3030~~~~
Linear1.0-90901/90~~~
Symmetric linear1.0-90901/90~~~
Inverse linear1.0-4545-1/45~~~
Symmetric inverse linear1.0-4545-1/45~~~
Cos~-9090~1.0~~
Sec~-9090~1.0~~
Cos_sec~-9090~~1.01.0
Sec_cos~-9090~~1.01.0
Hiking time~-7070~~~~
Bidirectional hiking time~-7070~~~~

Response

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

Use dark colors for code blocksCopy
1
2
3
4
{
  "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:

Use dark colors for code blocksCopy
1
https://<raster analysis tools url>/DistanceAccumulation/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:

Use dark colors for code blocksCopy
1
https://<raster analysis tools url>/DistanceAccumulation/jobs/<jobId>/results/<output parameter>

Example usage

Below is a sample request URL for DistanceAccumulation .

Use dark colors for code blocksCopy
1
https://services.myserver.com/arcgis/rest/services/System/RasterAnalysisTools/GPServer/DistanceAccumulation/submitJob

JSON Response syntax

The response returns the outputDistanceAccumulationRaster , outputBackDirectionRaster , outputSourceDirectionRaster , and outputSourceLocationRaster output parameters, which have properties for parameter name, data type, and value. The content of value is always the itemId of the output raster dataset and the image service URL.

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
{
  "paramName": <parameter name>,
  "dataType": "GPString",
  "value": {
    "itemId": <item Id>,
    "url": <URL>
  }
}

JSON Response example

Use dark colors for code blocksCopy
1
2
3
4
5
6
7
8
{
  "paramName": "outputDistanceAccumulationRaster",
  "dataType": "GPString",
  "value": {
    "itemId": "f121390b85ef419790479fc75b493efd",
    "url": "https://<server name>/arcgis/rest/services/Hosted/<service name>/ImageServer"
  }
}

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.