RouteTask

AMD: require(["esri/tasks/RouteTask"], (RouteTask) => { /* code goes here */ });
ESM: import RouteTask from "@arcgis/core/tasks/RouteTask";
Class: esri/tasks/RouteTask
Inheritance: RouteTask Task Accessor
Since: ArcGIS API for JavaScript 4.0
Deprecated since version 4.20. Use route instead.

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:

  1. Create the task
  2. Configure the parameters
  3. Solve the route and then specify what to do with its results and handle any errors that may be returned.
See also:

Constructors

new RouteTask(properties)
Parameter:
properties Object
optional

See the properties for a list of all the properties that may be passed into the constructor.

Property Overview

Any properties can be set, retrieved or listened to. See the Working with Properties topic.
Show inherited properties Hide inherited properties
Name Type Summary Class
Stringmore details

The name of the class.

more detailsAccessor
Stringmore details

The ArcGIS Server REST service URL (usually of a Feature Service Layer or Map Service Layer) for use in a task.

more detailsTask

Property Details

declaredClass Stringreadonly inherited
Since: ArcGIS API for JavaScript 4.7

The name of the class. The declared class name is formatted as esri.folder.className.

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>more details

Solves the route against the route layer with the route parameters.

more detailsRouteTask

Method Details

solve(params, requestOptions){Promise<RouteResult>}

Solves the route against the route layer with the route parameters.

Parameters:

Route parameters used as input to generate the route.

requestOptions Object
optional

Additional options to be used for the data request.

Returns:
Type Description
Promise<RouteResult> When resolved, returns an instance of RouteResult.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.