- URL:
- https://<root>/<serviceName>/RasterAnalysisTools/GPServer/OptimalPathAsLine
- Methods:
GET
- Version Introduced:
- 10.8.1
Description
The Optimal
task calculates the optimal path from a source to a destination as a feature.
To create paths that cross the edge of the projection, the rasters used as inputs for the Input Distance Accumulation
Raster and Input Back Direction
Raster parameters must have been created at the full global extent, in either a cylindrical projection or a geographic output coordinate system, while using the Geodesic
option for the Distance Method
parameter.
Example applications include the following:
- Finding the optimal route for a new road
- Finding the downstream trace from a location
Request parameters
Parameter | Details |
---|---|
(Required) | A raster or feature dataset that identifies the cells from which the optimal path is determined to the least costly source. If the input is a raster, it must consist of cells that have valid values (zero is a valid value) for the destinations, and the remaining cells must be assigned 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:
Feature input examples:
|
(Required) |
Determines the optimal path from the sources to the destinations when a cost back direction raster is used for the direction input. 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:
|
(Required) |
Determines the path to return to a source via the least-cost path or the optimal path. For each cell in the back direction, or flow direction raster, a value identifies the neighbor that is the next cell on the path from the cell to a source 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. Raster input examples:
|
(Required) | The name of the output feature service that will contain the optimal path. The task will create a feature service of the results. You can define the name of the service. Output feature service examples:
|
|
The field used to obtain values for the destination locations. The input feature service must contain at least one valid integer field. Example:
|
|
A string describing the path type, which can be
Example:
|
| Specifies whether complete, and possibly overlapping, paths from the destinations to the sources are calculated or if nonoverlapping network paths are created. Syntax: A Boolean value as either
Example:
|
| Contains additional settings that affect task execution.
|
|
The response format. The default response format is Values: |
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 job
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 job
to retrieve the results. To track the status, you can make a request of the following form:
https://<raster analysis tools url>/OptimalPathAsLine/jobs/<jobId>
When the status of the job request is esri
, you can access the results of the analysis by making a request of the following form:
https://<raster analysis tools url>/OptimalPathAsLine/jobs/<jobId>/results/outputOptimalPathAsLine
Example usage
Below is a sample request URL for Optimal
.
https://services.myserver.com/arcgis/rest/services/System/RasterAnalysisTools/GPServer/OptimalPathAsLine/submitJob
JSON Response example
The response returns the output
output parameter, which has properties for parameter name, data type, and value. The content of value
depends on the output
parameter being provided in the initial request. If output
was provided, value
contains the URL for the feature service layer. If output
was not provided, value
contains a feature collection.
output
is provided in the following request:
{
"paramName":"outputPolylineFeatures",
"dataType":"GPString",
"value":{"url":"<hosted feature service layer url>"}
}
output
is not provided in the following request:
{
"paramName":"outputPolylineFeatures",
"dataType":"GPString",
"value":{"layerDefinition": {}, "featureSet": {}}
}