RouteTask QML Type

A task to find a Route between two or more locations. More...

Import Statement: import Esri.ArcGISRuntime 100.15
Since: Esri.ArcGISRuntime 100.0
Inherits:

Object

Properties

Signals

Methods

Detailed Description

Use a RouteTask to find the best way to get from one location to another or to visit several locations. A route task is a network analysis task that solves a routing problem defined in a RouteParameters instance, using data in a transportation network dataset. The task calculates the route between a series of locations, known as stops. A route task is executed asynchronously. A successful execution returns a RouteResult instance with details about the route.

When working in an online connected scenario, the transportation network can be published to ArcGIS Server as an online Network Analyst routing service. Esri also provides ready-to-use services, such as the Directions and Routing Services, which requires authentication with an ArcGIS organizational account. In connected scenarios, provide a URL to the REST endpoint of the service, along with any necessary credentials.

When working offline in a disconnected scenario, the transportation network can be exported as a Runtime-enabled network from either ArcMap or ArcGIS Pro. If you are using ArcMap, run the Create Runtime Content geoprocessing tool, and reference a map document that contains the network dataset you want to export. This will output a mobile geodatabase (*.geodatabase), and a transportation network folder (*.tn). Create route task by loading the mobile geodatabase and transportation network folder onto the device, setting the URL property to a local path to the mobile geodatabase that contains the network, and setting the networkName property to the name of the network dataset. If you are using ArcGIS Pro, run the Create Mobile Map Package geoprocessing tool, and select the map and network dataset that you wish to export. The output is a mobile map package (*.mmpk) which is a compressed file containing everything needed to use the route task offline. To solve network analyst routes, load a mobile map package onto your device, extract the map from the package, and access the transportation network from each map. Each transportation networks contain the geodatabase and the network name needed to execute a route task.

An example of an online RouteTask:

RouteTask {
    id: onlineRouteTask
    url: "https://www.myServer.com/arcgis/rest/services/routing/NAServer/Route"
}

And for offline routing a local path is provided along with a network name:

RouteTask {
    id: offlineRouteTask
    url: "file:///Users/<username>/routing.geodatabase"
    networkName: "Streets_ND"
}

Note: The url and transportationNetworkDataset properties should not both be assigned. A RouteTask may be initialized from one or the other, but not both. In the event that both are assigned, the last one assigned takes precedence and will be used to initialize the RouteTask.

This QML type supports the following default properties. A default property may be declared inside another declared object without being assigned explicitly to a property.

TypeDefault Property
Credentialcredential
RequestConfigurationrequestConfiguration (since Esri.ArcGISRuntime 100.1)

See also ApiKeyResource, Cancelable, Loadable, RemoteResource, MobileMapPackage, and Route REST API documentation.

Property Documentation

apiKey : string

Returns the API key.

This property was introduced in Esri.ArcGISRuntime 100.10.

See also ApiKeyResource.


createDefaultParametersResult : RouteParameters

Results from createDefaultParameters(), giving access to the default RouteParameters (read-only).

Obtain this property after the createDefaultParametersStatusChanged signal emits, and the createDefaultParametersStatus is complete.


createDefaultParametersStatus : Enums.TaskStatus

Returns the current status of the createDefaultParameters method (read-only).

Wait until the createDefaultParametersStatus is Enums.TaskStatusComplete before obtaining the createDefaultParametersResult.

See also Enums.TaskStatus.


createParametersResult : RouteParameters

Results from createParameters(), giving access to the RouteParameters (read-only).

Obtain this property after the createParametersStatusChanged signal emits, and the createParametersStatus property is complete.

This property was introduced in Esri.ArcGISRuntime 100.1.


createParametersStatus : Enums.TaskStatus

Returns the current status of the createParameters method (read-only).

Wait until the createParametersStatus is Enums.TaskStatusComplete before obtaining the createParametersResult.

This property was introduced in Esri.ArcGISRuntime 100.1.

See also Enums.TaskStatus.


createParametersWithPortalItemResult : RouteParameters

Results from createParametersWithPortalItem(), giving access to the RouteParameters (read-only).

Obtain this property after the createParametersWithPortalItemStatusChanged signal emits, and the createParametersWithPortalItemStatus property is complete.

This property was introduced in Esri.ArcGISRuntime 100.3.


createParametersWithPortalItemStatus : Enums.TaskStatus

Returns the current status of the createParametersWithPortalItem method (read-only).

Wait until the createParametersWithPortalItemStatus is Enums.TaskStatusComplete before obtaining the createParametersWithPortalItemResult.

This property was introduced in Esri.ArcGISRuntime 100.3.

See also Enums.TaskStatus.


[default] credential : Credential

The Credential for authenticating against a secured service.

Only applicable if using an online service that is secured.


error : Error

Returns the error object (read-only).

See also Loadable and Error.


loadError : Error

Returns the load error (read-only).

Note: load errors are also reported on the error property and emit the errorChanged signal.

See also Loadable.


loadStatus : Enums.LoadStatus

Returns the load status (read-only).

See also Loadable and Enums.LoadStatus.


networkName : string

The network dataset's name in the mobile geodatabase.

Note: This property is only used for offline routing.


[default] requestConfiguration : RequestConfiguration

The configuration parameters used for network requests sent by this task.

This property was introduced in Esri.ArcGISRuntime 100.1.


routeTaskInfo : RouteTaskInfo

Returns RouteTaskInfo about the RouteTask (read-only).

Wait until the RouteTask is loaded before attempting to obtain the RouteTaskInfo.


solveRouteResult : RouteResult

Results from solveRoute(), giving access to the output RouteResult (read-only).

Obtain this property after the solveRouteStatusChanged signal emits, and the solveRouteStatus property is complete.


solveRouteStatus : Enums.TaskStatus

Returns the current status of the solveRoute method (read-only).

Wait until the solveRouteStatus is Enums.TaskStatusComplete before obtaining the solveRouteResult.

See also Enums.TaskStatus.


transportationNetworkDataset : TransportationNetworkDataset

Returns the TransportationNetworkDataset used to initialize the RouteTask.


url : url

The URL to the REST endpoint of the service or a local path to a mobile geodatabase.


Signal Documentation

apiKeyChanged()

Emitted when the apiKey property changes.

Note: The corresponding handler is onApiKeyChanged.

This signal was introduced in Esri.ArcGISRuntime 100.10.

See also ApiKeyResource.


createDefaultParametersStatusChanged()

Emitted when the createDefaultParametersStatus property of this RouteTask changes.

Note: The corresponding handler is onCreateDefaultParametersStatusChanged.


createParametersStatusChanged()

Emitted when the createParametersStatus property of this RouteTask changes.

Note: The corresponding handler is onCreateParametersStatusChanged.

This signal was introduced in Esri.ArcGISRuntime 100.1.


createParametersWithPortalItemStatusChanged()

Emitted when the createParametersWithPortalItemStatus property of this RouteTask changes.

Note: The corresponding handler is onCreateParametersWithPortalItemStatusChanged.

This signal was introduced in Esri.ArcGISRuntime 100.3.


credentialChanged()

Emitted when the credential property of this RouteTask changes.

Note: The corresponding handler is onCredentialChanged.


loadErrorChanged()

Emitted when the loadError property of this RouteTask changes.

Note: load errors are also reported on the error property and emit the errorChanged signal.

Note: The corresponding handler is onLoadErrorChanged.

See also Loadable and Object.


loadStatusChanged()

Emitted when the loadStatus property of this RouteTask changes.

Note: The corresponding handler is onLoadStatusChanged.

See also Loadable.


networkNameChanged()

Emitted when the networkName property of this RouteTask changes.

Note: The corresponding handler is onNetworkNameChanged.


requestConfigurationChanged()

Emitted when the requestConfiguration property changes.

Note: The corresponding handler is onRequestConfigurationChanged.

This signal was introduced in Esri.ArcGISRuntime 100.1.


routeTaskInfoChanged()

Emitted when the routeTaskInfo property of this RouteTask changes.

Note: The corresponding handler is onRouteTaskInfoChanged.


solveRouteStatusChanged()

Emitted when the solveRouteStatus property of this RouteTask changes.

Note: The corresponding handler is onSolveRouteStatusChanged.


transportationNetworkDatasetChanged()

Emitted when the transportationNetworkDataset property changes.

Note: The corresponding handler is onTransportationNetworkDatasetChanged.

This signal was introduced in Esri.ArcGISRuntime 100.1.


urlChanged()

Emitted when the url property of this RouteTask changes.

Note: The corresponding handler is onUrlChanged.


Method Documentation

void cancelLoad()

See also Loadable.


bool cancelTask(string taskId)

Cancel the task with the ID taskId.

Returns false if the task cannot be canceled or there is no task with the specified id taskId.

See also Cancelable.


string createDefaultParameters()

Creates default route parameters from the service or database.

The createDefaultParametersStatusChanged signal will emit once the operation is complete, giving access to the createDefaultParametersResult.


string createParameters(FeatureCollection featureCollection)

Creates the route parameters from a feature collection for this route task.

Imported route parameters from a feature collection will be adjusted to the current RouteTask.

Please note:

featureCollection must contain at least a Stops table.

The createParametersStatusChanged signal emits when the operation is complete, giving access to the createParametersResult.

This method was introduced in Esri.ArcGISRuntime 100.1.


string createParametersWithPortalItem(PortalItem portalItem)

Creates the route parameters from a portal item for this route task.

This operation allows the user to download a set of route parameters stored in the portal and use them to solve routing problems locally on the device. Imported route parameters from the portal item will be adjusted to the current RouteTask.

  • portalItem - The portal item object with a feature collection that contains stops, route info, and barriers tables. A stops table is required.

Please note:

The createParametersWithPortalItemStatusChanged signal emits when the operation is complete, giving access to the createParametersWithPortalItemResult.

This method was introduced in Esri.ArcGISRuntime 100.3.


void load()

See also Loadable.


void retryLoad()

See also Loadable.


string solveRoute(RouteParameters routeParameters)

Solves a route with the given routeParameters.

The solveRouteStatusChanged signal will emit when the operation is complete, giving access to the solveRouteResult.


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