RouteTask
require(["esri/tasks/RouteTask"], function(RouteTask) { /* code goes here */ });
esri/tasks/RouteTask
Find routes between two or more locations and optionally get driving directions. The RouteTask uses ArcGIS Server network analysis services to calculate routes. Network analysis services allow you to solve simple routing problems as well as complex ones that take into account multiple stops, barriers, and time windows.
To work directly with the RouteTask, the basic pattern is:
- Create the task
- Configure the parameters
- Solve the route and then specify what to do with its results and handle any errors that may be returned.
Constructors
- new RouteTask(properties)
- Parameter:properties Objectoptional
See the properties for a list of all the properties that may be passed into the constructor.
Property Overview
Name | Type | Summary | Class | |
---|---|---|---|---|
String | The name of the class. more details | more details | Accessor | |
Object | The options to be used for data requests. more details | more details | Task | |
String | The ArcGIS Server REST service URL (usually of a Feature Service Layer or Map Service Layer) for use in a task. more details | more details | Task |
Property Details
- Since: ArcGIS API for JavaScript 4.7
The name of the class. The declared class name is formatted as
esri.folder.className
.
The options to be used for data requests. These options can also be controlled through the
requestOptions
method parameter.
The ArcGIS Server REST service URL (usually of a Feature Service Layer or Map Service Layer) for use in a task.
Method Overview
Name | Return Type | Summary | Class | |
---|---|---|---|---|
Promise<RouteResult> | Solves the route against the route layer with the route parameters. more details | more details | RouteTask |
Method Details
- solve(params, requestOptions){Promise<RouteResult>}
Solves the route against the route layer with the route parameters.
Parameters:params RouteParametersRoute parameters used as input to generate the route.
requestOptions ObjectoptionalAdditional options to be used for the data request (will override requestOptions defined during construction).
Returns:Type Description Promise<RouteResult> When resolved, returns an instance of RouteResult.