OnlineRoutePlanner

public final class OnlineRoutePlanner : RoutePlanner

The Online Route Planner is a REST wrapper for a suite of web services that allow developers to use our scalable routing engine.

Important

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

Lifecycle

  • Important

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

    Declaration

    Swift

    public convenience init(apiKey: String)

    Parameters

    apiKey

    A valid TomTom Service API Key.

  • Initializer with the option to specify a Base URL

    Important

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

    Declaration

    Swift

    public convenience init(baseURL: String, apiKey: String)

    Parameters

    baseURL

    A base URL to use for requests. An example: https://custom.api.com

    apiKey

    A valid TomTom Service API Key.

Public

  • This function calculates a route between an origin and a destination, passing through waypoints (if specified). Additional routing parameters like traffic, things to avoid, departure/arrival time, etc. can be taken into account using RoutePlanningOptions.

    Important

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

    Declaration

    Swift

    public func planRoute(
        options: RoutePlanningOptions,
        onRouteReady: ((Route) -> ())?,
        completion: @escaping (Result<RoutingResponse, Error>) -> ()
    )

    Parameters

    options

    The RoutePlanningOptions with parameters for the request

    onRouteReady

    The onRouteReady closure is not used. Online incremental path alternatives are not implemented.

    completion

    The completion closure is called on the main queue after the response to the request has been processed. If no errors occurred, RoutingResponse contains an array of routes between an origin and a destination. The error type is RoutingError

  • Declaration

    Swift

    public func cancelPendingRequests()
  • This function calculates route contents (instructions, lane guidance) within its certain part using the provided [RouteIncrementOptions] object.

    Note: It’s currently expected that only following Route contents will be updated: Route.legs(i).instructions Route.laneSections

    Declaration

    Swift

    public func advanceGuidanceProgress(with options: RouteIncrementOptions) -> Result<Route, Error>

    Parameters

    options

    The RoutePlanningOptions. Note: Route ETA should be updated outside [increment] call

    Return Value

    If the call succeeds, return a Route. If it fails, return an Error.