- URL:https://<rasteranalysistools-url>/CalculateTravelCost
- Version Introduced:10.6
Description
The CalculateTravelCost task calculates the cost distance from a single source or set of sources, while accounting for surface distance and horizontal and vertical cost factors.
Tip:
The Distance Accumulation or Distance Allocation tasks provide enhanced functionality or performance.
While the CalculateDistance task is the straight line distance between locations, the travel cost tools explore the movement of a traveler over a landscape. The CalculateTravelCost operation calculates 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 lease expensive route to construct a new road to a proposed school.
- Connect the best habitat patches for bobcat 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
Parameter | Details |
---|---|
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:
Feature input examples:
|
outputDistanceName | The output distance image service name that will be created. This calculates, for each cell, the Euclidean 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:
Output raster examples:
|
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:
|
inputSurfaceRaster | A raster defining the elevation values at each cell location. 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:
|
maximumDistance | Defines the threshold that the accumulative cost values cannot exceed. Syntax: This parameter can only be specified as a numerical value. Example:
|
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:
|
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 of the factors, a particular selection of characteristic modifiers will apply. See the Horizontal factor additional information section below for specific details on the settings of the factors and how to set the modifiers of the characteristics. Values: BINARY | FORWARD | LINEAR | INVERSE_LINEAR Characteristics: Zero factor | Cut angle | Slope | Side value Syntax: The parameter is a string. Examples:
|
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:
|
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 for moving into a neighboring cell. For each of the factors, a particular selection of characteristic modifiers will apply. See the Vertical factor additional information section below for specific details on the settings of the factors and how to set the modifiers of the characteristics. Values: BINARY | LINEAR | SYMMETRIC_LINEAR | INVERSE_LINEAR | SYMMETRIC_INVERSE_LINEAR | COS | SEC | COS_SEC | SEC_COS Characteristics: Zero factor | Low cut angle | High Cut Angle | Slope Syntax: This parameter is a string. Examples:
|
sourceCostMultiplier | Multiplier to apply to the cost values. Syntax: This parameter can be specified as a Double value or as a field. Examples:
|
sourceStartCost | 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:
|
sourceResistanceRate | This parameter simulates the increase in effort to overcome costs as the accumulative cost increases. Syntax: This parameter can be specified as a Double value or as a field. Examples:
|
sourceCapacity | Defines the cost capacity for the traveler for a source. Syntax: This parameter can be specified as a Double value or as a field. Examples:
|
sourceTravelDirection | Defines the direction of the traveler when applying horizontal and vertical factors, the source resistance rate, and the source starting cost. Syntax: A string describing the optimization method, which can be one of the following:
Example:
|
outputBlacklinkName | The output back link image service name 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:
|
outputAllocationName | The output allocation image service name 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:
|
allocationField | A field on the inputSourceRasterOrFeatures layer that holds the values that define each source. Syntax: This can be an integer or a string field of the source dataset. Example:
|
context | Contains additional settings that affect task processing. This task has the following settings:
|
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: Horizontal Factor (HF), which defines the horizontal difficulty encountered when moving from one cell to the next, and Horizontal Relative Moving Angle (HRMA), which identifies the angle between the horizontal direction from a cell and the moving direction.
Horizontal factor keywords
Keywords | Description |
---|---|
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. |
Horizontal factor keyword characteristics
Characteristics | Description |
---|---|
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
Keywords | Definitions |
---|---|
BINARY | Specifies 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 | Indicates 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 | Indicates 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 the 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. |
Vertical factor keyword characteristics
Characteristic | Definition |
---|---|
Zero factor | Establishes the vertical factor 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>/CalculateTravelCost/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>/CalculateTravelCost/jobs/<jobId>/results/<output parameter>
Example usage
Below is a sample request URL for CalculateTravelCost.
https://services.myserver.com/arcgis/rest/services/System/RasterAnalysisTools/GPServer/CalculateTravelCost/submitJob
JSON response syntax
The response returns the outputDistanceRaster, outputBacklinkRaster, and outputAllocationRaster 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": "outputDistanceRaster",
"dataType": "GPString",
"value": {
"itemId": "f121390b85ef419790479fc75b493efd",
"url": "https://<server name>/arcgis/rest/services/Hosted/<service name>/ImageServer"
}
}