Solve a route on-the-fly using offline data.
You can use an offline network to enable routing in disconnected scenarios. For example, you could provide offline location capabilities to field workers repairing critical infrastructure in a disaster when network availability is limited.
Click near a road to start adding a stop to the route, click again to place it on the map. A number graphic will show its order in the route. After adding at least 2 stops, a route will display. Choose "Fastest" or "Shortest" to control how the route is optimized. The route will update on-the-fly while moving stops. The green box marks the boundary of the routable area provided by the offline data. This sample limits routes to 5 stops for performance reasons.
- Create the map's
Basemap
from a local tile package using aTileCache
andArcGISTiledLayer
- Create a
RouteTask
with an offline locator geodatabase. - Get the
RouteParameters
usingrouteTask.CreateDefaultParameters()
- Create
Stop
s and add them to the route task's parameters. - Solve the
Route
usingrouteTask.SolveRouteAsync(routeParameters)
- Create a graphic with the route's geometry and a
SimpleLineSymbol
and display it on anotherGraphicsOverlay
.
- RouteParameters
- RouteResult
- RouteTask
- Stop
- TravelMode
The data used by this sample is available on ArcGIS Online.
This sample uses a pre-packaged sample dataset consisting of a geodatabase with a San Diego road network and a tile package with a streets basemap.
connectivity, disconnected, fastest, locator, navigation, network analysis, offline, routing, shortest, turn-by-turn