Navigation visualization

VERSION 0.18.1
PUBLIC PREVIEW

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 (...)
    6end

Creating a Navigation Visualization entry point

Use the NavigationVisualizationServiceBuilderProtocol.build 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!
2
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 )
13}

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)
3}

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)
3}
center

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.

center

Next steps

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