- URL:https://<rasteranalysistools-url>/DetermineTravelCostPathAsPolyline
- Version Introduced:10.6.1
Description
The DetermineTravelCostPathAsPolyline task calculates the least-cost path between sources and destinations.
Sugerencia:
The Distance Accumulation and Optimal Path As Line tasks provide enhanced functionality or performance.
The path determined by this operation is relative to the cost defined by the cost raster. An application for this operation includes trying to find the least cost route for a new road.
Request parameters
Parameter | Details |
---|---|
inputSourceRasterOrFeatures (Required) | The layer that identifies the cells to determine the least costly path from. 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:
|
inputCostRaster (Required) | A raster defining the impedance or cost to move planimetrically through each cell. The value at each cell location represents the cost-per-unit distance for moving through the cell. Each cell location value is multiplied by the cell resolution while also compensating for diagonal movement to obtain the total cost of passing through the cell. The values of the cost raster can be an integer or a floating point, but they cannot be negative or zero as you cannot have a negative or zero cost. 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:
|
inputDestinationRasterOrFeatures (Required) | The layer that defines the destinations used to calculate the distance. The layer can be an image service or a feature service. 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:
|
outputPolylineName (Required) | The task will create a feature service of the results. You can define the name of the service. Output feature service examples:
|
pathType |
A string describing the path type, which can either be BEST_SINGLE, EACH_CELL, or EACH_ZONE.
Example:
|
destinationField | The field used to obtain values for the destination locations. The input feature service must contain at least one valid integer field. 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 |
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>/DetermineTravelCostPathAsPolyline/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>/DetermineTravelCostPathsAsPolyline/jobs/<jobId>/results/outputPolylineFeatures
Example usage
Below is a sample request URL for DetermineTravelCostPathAsPolyline.
https://services.myserver.com/arcgis/rest/services/System/RasterAnalysisTools/GPServer/DetermineTravelCostPathAsPolyline/submitJob
JSON Response example
The response returns the outputPolylineFeatures output parameter, which has properties for parameter name, data type, and value. The content of value depends on the outputPolylineName parameter being provided in the initial request. If outputPolylineName was provided, value contains the URL for the feature service layer. If outputPolylineName was not provided, value contains a feature collection.
outputPolylineName is provided in request:
{
"paramName":"outputPolylineFeatures",
"dataType":"GPString",
"value":{"url":"<hosted feature service layer url>"}
}
outputPolylineName is not provided in request:
{
"paramName":"outputPolylineFeatures",
"dataType":"GPString",
"value":{"layerDefinition": {}, "featureSet": {}}
}