TomTomSDKRouteReplanner

TomTomSDKRouteReplanner

The Route Replanner module provides an interface for dynamic route planning during navigation. This module enhances the navigation experience by enabling real-time adjustments to the current route based on various factors, ensuring that users can efficiently reach their destinations.

Functionalities
  • Dynamic Route Updating: facilitates real-time updates to the route, allowing users to receive the latest navigation information as conditions change.
  • Route Recovery Planning: facilitates planning a route back to the original path, ensuring that users can easily return to their intended course.
  • Incremental Route Calculation: incrementally calculates route content, including navigation instructions and lane guidance, providing users with timely and relevant information throughout their journey.

RouteReplanner serves as the interface for performing route replanning actions for dynamic use cases.



API Overview

  • Options for planning back to route.

    BackToRouteOptions encapsulates all the necessary data and options required for replanning a route in navigation scenarios.

    Important

    This is a Public Preview API. It may be changed or removed at any time.
    See more

    Declaration

    Swift

    public struct BackToRouteOptions
  • Provides dynamic route replanning capabilities by updating routes, handling deviations, and incrementally updating route guidance.

    Overview

    The RouteReplanner API enables dynamic route replanning during navigation. By integrating this API, developers can:

    • Update routes in real-time
    • Manage route deviations
    • Incrementally guide users with updated instructions and lane guidance. The RouteReplanner is used by the RouteReplanningEngine to perform route replanning based on the NavigationSnapshot of the current navigation session. The RouteReplanningEngine determines the timing and method selection for the RouteReplanner to call. The Navigation SDK provides RouteReplannerFactory to create instances of the RouteReplanner for the selected mode, and HybridRouteReplanner implementation for hybrid mode.

    Code Snippets

    Example: Refreshing a Route

    let updateOptions = RouteUpdateOptions(...) // Configure your route update options
    let routeStream = routeReplanner.update(updateOptions)
    for try await route in routeStream {
        // Handle updated route
    }
    

    Example: Handling Route Deviations

    let deviationOptions = BackToRouteOptions(...) // Configure your deviation options
    let deviationStream = routeReplanner.backToRoute(deviationOptions)
    for try await route in deviationStream {
        // Handle deviation update
    }
    
    Example: Incremental Route Guidance
    let incrementOptions = RouteIncrementOptions(...) // Configure your increment options
    let updatedRoute = try await routeReplanner.advanceGuidanceProgress(incrementOptions)
    // Use the updated route
    

    Threading Requirements

    The methods in RouteReplanner are designed to be called from asynchronous contexts. The methods provided by the RouteReplanner should be called on a background thread as they involve time-consuming operations, such as network requests and offline route computation.

    Important

    This is a Public Preview API. It may be changed or removed at any time.
    See more

    Declaration

    Swift

    public protocol RouteReplanner
  • Options for updating a route.

    RouteUpdateOptions encapsulates all the necessary data and options required for updating a route in navigation scenarios.

    Important

    This is a Public Preview API. It may be changed or removed at any time.
    See more

    Declaration

    Swift

    public struct RouteUpdateOptions