Display directions for a route between two points.

Use case
Find routes with driving directions between any number of locations. You might use the ArcGIS platform to create a custom network for routing on private roads.
How to use the sample
For simplicity, the sample comes loaded with a start and end stop. You can click on the Find Route button to display a route between these stops. Once the route is generated, tap the directions icon for turn-by-turn directions shown in a list.
How it works
- Create a
RouteTaskinstance using a URL to an online route service. - Create default
RouteParametersusingRouteTask.createDefaultParameters(). - Set
returnDirectionson the parameters totrue. - Create
Stopinstances for each destination and assign the stops to the route parameters usingRouteParameters.setStops(_:). - Solve the route using
RouteTask.solveRoute(routeParameters:)to get aRouteResult. - Create
GraphicsOverlayandGraphicinstances for the route and stops. - Iterate through the result’s
Routes. To display the route, update the route graphic’s geometry with the route’srouteGeometry. To display directions, get the direction maneuvers from the route’sdirectionManeuversproperty, and, for each maneuver, display the maneuver’sdirectionText.
Relevant API
- DirectionManeuver
- Route
- RouteParameters
- RouteParameters.setStops(_:)
- RouteResult
- RouteTask
- RouteTask.createDefaultParameters()
- RouteTask.solveRoute(routeParameters:)
- Stop
Tags
directions, driving, navigation, network, network analysis, route, routing, shortest path, turn-by-turn