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: |
Properties
- apiKey : string
- createDefaultParametersResult : RouteParameters
- createDefaultParametersStatus : Enums.TaskStatus
- createParametersResult : RouteParameters
- createParametersStatus : Enums.TaskStatus
- createParametersWithPortalItemResult : RouteParameters
- createParametersWithPortalItemStatus : Enums.TaskStatus
- credential : Credential
- error : Error
- loadError : Error
- loadStatus : Enums.LoadStatus
- networkName : string
- requestConfiguration : RequestConfiguration
- routeTaskInfo : RouteTaskInfo
- solveRouteResult : RouteResult
- solveRouteStatus : Enums.TaskStatus
- transportationNetworkDataset : TransportationNetworkDataset
- url : url
Signals
- apiKeyChanged()
- createDefaultParametersStatusChanged()
- createParametersStatusChanged()
- createParametersWithPortalItemStatusChanged()
- credentialChanged()
- loadErrorChanged()
- loadStatusChanged()
- networkNameChanged()
- requestConfigurationChanged()
- routeTaskInfoChanged()
- solveRouteStatusChanged()
- transportationNetworkDatasetChanged()
- urlChanged()
Methods
- void cancelLoad()
- bool cancelTask(string taskId)
- string createDefaultParameters()
- string createParameters(FeatureCollection featureCollection)
- string createParametersWithPortalItem(PortalItem portalItem)
- void load()
- void retryLoad()
- string solveRoute(RouteParameters routeParameters)
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.
Type | Default Property |
---|---|
Credential | credential |
RequestConfiguration | requestConfiguration (since Esri.ArcGISRuntime 100.1) |
See also ApiKeyResource, Cancelable, Loadable, RemoteResource, MobileMapPackage, and Route REST API documentation.
Property Documentation
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.
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.
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.
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.
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.
Returns the load status (read-only).
See also Loadable and Enums.LoadStatus.
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.
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.
Signal Documentation
Emitted when the apiKey property changes.
Note: The corresponding handler is onApiKeyChanged
.
This signal was introduced in Esri.ArcGISRuntime 100.10.
See also ApiKeyResource.
Emitted when the createDefaultParametersStatus property of this RouteTask changes.
Note: The corresponding handler is onCreateDefaultParametersStatusChanged
.
Emitted when the createParametersStatus property of this RouteTask changes.
Note: The corresponding handler is onCreateParametersStatusChanged
.
This signal was introduced in Esri.ArcGISRuntime 100.1.
Emitted when the createParametersWithPortalItemStatus property of this RouteTask changes.
Note: The corresponding handler is onCreateParametersWithPortalItemStatusChanged
.
This signal was introduced in Esri.ArcGISRuntime 100.3.
Emitted when the credential property of this RouteTask changes.
Note: The corresponding handler is onCredentialChanged
.
Emitted when the loadStatus property of this RouteTask changes.
Note: The corresponding handler is onLoadStatusChanged
.
See also Loadable.
Emitted when the networkName property of this RouteTask changes.
Note: The corresponding handler is onNetworkNameChanged
.
Emitted when the requestConfiguration property changes.
Note: The corresponding handler is onRequestConfigurationChanged
.
This signal was introduced in Esri.ArcGISRuntime 100.1.
Emitted when the routeTaskInfo property of this RouteTask changes.
Note: The corresponding handler is onRouteTaskInfoChanged
.
Emitted when the solveRouteStatus property of this RouteTask changes.
Note: The corresponding handler is onSolveRouteStatusChanged
.
Emitted when the transportationNetworkDataset property changes.
Note: The corresponding handler is onTransportationNetworkDatasetChanged
.
This signal was introduced in Esri.ArcGISRuntime 100.1.
Method Documentation
See also Loadable.
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.
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:
- If travel mode obtained from a featureCollection cannot be applied to current RouteTask, then it will be null.
- In cases where travel mode is null, the client can override it with another travel mode, such as one obtained from RouteTaskInfo.travelModes.
- Accumulate attributes from the route info table are applied only if they exist in RouteTaskInfo.restrictionAttributes and RouteTaskInfo.costAttributes for the current RouteTask.
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:
- portalItem must contain at least a
Stops
table. - If the travel mode obtained from the FeatureCollection of portalItem cannot be applied to current RouteTask, then it will be null.
- In cases where travel mode is null, the client can override it with another travel mode, such as one obtained from RouteTaskInfo.travelModes.
- Accumulate attributes from the route info table are applied only if they exist in RouteTaskInfo.restrictionAttributes and RouteTaskInfo.costAttributes for the current RouteTask.
The createParametersWithPortalItemStatusChanged signal emits when the operation is complete, giving access to the createParametersWithPortalItemResult.
This method was introduced in Esri.ArcGISRuntime 100.3.
See also Loadable.
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.