Sorry, you need to enable JavaScript to visit this website.

Route display

Route display

You can display a route on the map and customize its origin and destination icons.

Sample use case: when you add the route, you would like to highlight the starting and
the destination points. Also you would like to plan several routes simultaneously
with different origin and destination points and use different icons.

Prerequisites:

TTMapView *mapView object was created and configured. Route coordinates are prepared.

You should also add your start and end route icons to assets, you can call it as you want, e.g. “Start” end “End”.
Icons are added to the route when TTMapRoute object is created, using imageStart and imageEnd fabric methods.
"Start" and "End" here are names of icons from assets. And then pass mapRoute object to addRoute
method of mapView.routeManager object, e.g.:

_

let mapRoute = TTMapRoute(coordinatesData: planedRoute,
                          imageStart: TTMapRoute.defaultImageDeparture(),
                          imageEnd: TTMapRoute.defaultImageDestination())
mapView.routeManager.add(mapRoute)
mapRoute.isActive = isActive
mapRoute.extraData = planedRoute.summary
TTMapRoute *mapRoute = [TTMapRoute routeWithCoordinatesData:planedRoute
                                                 imageStart:[TTMapRoute defaultImageDeparture]
                                                   imageEnd:[TTMapRoute defaultImageDestination]];
[self.mapView.routeManager addRoute:mapRoute];
mapRoute.active = isActive;
mapRoute.extraData = planedRoute.summary;

 

If you don’t call imageStart and imageEnd methods there will be no icons on the route.
You can specify only start icon by calling only imageStart or only end icon by calling only
imageEnd. You can use different images from assets for different routes.