Skip To Content

Distance Accumulation

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.

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:

"inputSourceRasterOrFeatures":{"itemID": <portal item ID>}
"inputSourceRasterOrFeature":{"url": <image service layer url>}

Feature input examples:

//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:

"outputDistanceAccumulationRasterName":{"serviceProperties":{"name":"testrasteranalysis"}}

Output raster examples:

//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:

"inputBarrierRasterOrFeatures":{"itemID": <portal item ID>}
"inputBarrierRasterOrFeatures":{"url": <image service layer url>}

Feature input examples:

//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:

//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.

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:

//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:

//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 | TABLE

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

Syntax: This parameter is a string.

Examples:

"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:

//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:

"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:

"outputBackDirectionRasterName":{"serviceProperties":{"name":"testrasteranalysis"}}

Output raster examples:

//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:

"outputSourceDirectionRasterName":{"serviceProperties":{"name":"testrasteranalysis"}}

Output raster examples:

//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:

"outputSourceLocationRasterName":{"serviceProperties":{"name":"testrasteranalysis"}}

Output raster examples:

//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:

//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:

//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:

//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:

"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:

"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:

Keywords         Zero factor   Cut angle     Slope   Side value
--------------   -----------   -----------   -----   ----------
Binary           1.0            45           ~       ~
Forward          0.5            45 (fixed)   ~       1.0
Linear           0.5           181            1/90   ~
Inverse linear   2.0           180           -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.

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:

Keyword                   Zero factor  Low cut  High cut    Slope  Power  Cos    Sec
                                       angle    angle                     power  power            
------------------------  -----------  -------  ----------  -----  -----  -----  -----
Binary                    1.0          -30      30          ~      ~      ~      ~
Linear                    1.0          -90      90           1/90  ~      ~      ~
Symmetric linear          1.0          -90      90           1/90  ~      ~      ~
Inverse linear            1.0          -45      45          -1/45  ~      ~      ~
Symmetric inverse linear  1.0          -45      45          -1/45  ~      ~      ~
Cos                       ~            -90      90          ~      1.0    ~      ~
Sec                       ~            -90      90          ~      1.0    ~      ~
Cos_sec                   ~            -90      90          ~      ~      1.0    1.0
Sec_cos                   ~            -90      90          ~      ~      1.0    1.0

Response

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>/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:

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

Example usage

Below is a sample request URL for DistanceAccumulation.

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.

{
  "paramName": <parameter name>,
  "dataType": "GPString",
  "value": {
    "itemId": <item Id>,
    "url": <URL>
  }
}

JSON Response example


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

Related topics