Navigation visualization

VERSION 0.18.1

You can use the Navigation Visualization add-on to provide users with a basic navigation experience by visualizing navigation features such as routes and guidance.

Project setup

The Navigation SDK for iOS is only available upon request. Contact us to get started.

  1. Configure the project as described in the Project setup guide.
  2. Add the Navigation Visualization add-on dependency in the Podfile
    1target 'YourAppTarget' do
    2 use_frameworks!
    3 (...)
    4 pod 'TomTomSDKAddonNavigationVisualization'
    5 (...)

Creating a Navigation Visualization entry point

Use the method to create the NavigationVisualizationServiceProtocol instance. It takes three arguments:

  1. map: a TomTomMap object.
  2. navigation: a Navigation object.
  3. styleConfiguration: a StyleConfiguration object. This is an optional object; if it’s not passed, then the default style will be used.
1var navigationVisualizationService: NavigationVisualizationServiceProtocol!
3func buildNavigationVisualizationService(
4 map: TomTomMap,
5 navigation: Navigation,
6 styleConfiguration: StyleConfiguration
7) throws {
8 navigationVisualizationService = try NavigationVisualizationServiceBuilder().build(
9 map: map,
10 navigation: navigation,
11 styleConfiguration: styleConfiguration
12 )

Displaying routes

Pass a set of routes to the displayRoutes to show them on the map.

1func displayRoutes(routes: [TomTomSDKRoute.Route]) {
2 navigationVisualizationService.displayRoutes(routes: routes)

By default, the first Route is selected, and all others are marked as alternatives.

The selected Route can be changed by using the selectRoute method. This method takes a Route object that is part of the displayed Route collection as an argument.

1func selectRoute(_ route: TomTomSDKMapDisplay.Route) {
2 navigationVisualizationService.selectRoute(route)

Displaying the selected route during navigation

Once Navigation.start is called to start the navigation session, the selected route becomes the active Route. During its lifecycle, the NavigationVisualizationServiceProvider object subscribes to different navigation events in order to display information about route progress.

The navigation session can be stopped by calling the Navigation.stop method.


Next steps

Now that you’ve set up the addon, here are some suggestions to extend the functionality: