Route around barriers

Description

This sample demonstrates how to generate a route among multiple stops taking into account different barriers. Select Stops from the switch in the toolbar. Tap on the map to add any number of stops. Then select Barriers and tap on the map to add buffered points as barriers. Tap on the settings button to pick among different routing options. Now tap on the Route button to generate a route connecting all the stops you added. Once the route is computed, you will see the route length and the travel time displayed. The directions list button will also be enabled. When you tap on the directions button you will see a list of directions. You can select each direction to highlight it on the map. If you want to delete a route tap on the trash icon next to the route details. And if you want to delete either stops or barriers, select the right one on the switch and tap on the trash icon in the toolbar.

Route around barriers

How it works

The sample uses the generateDefaultParametersWithCompletion: method on AGSRouteTask to get the default parameters from the service. Set the stops and barriers in those parameters and the returnDirections to be true. The solveRouteWithParameters:completion: method solves for the route using these parameters. Once the route is completed, the sample displays the route and the list of directions. The directions are obtained from the directionManeuvers property on the AGSRoute returned in the AGSRouteResult.


In this topic
  1. Description