OnlineRoutePlanner
public final class OnlineRoutePlanner : RoutePlanner, ReachableRangeRoutingService
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.-
Initializer with the option to specify a Base URL
Declaration
Swift
public convenience init(baseURL: String)
Parameters
baseURL
A base URL to use for requests. An example: https://custom.api.com
-
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
.Declaration
Swift
public func planRoute( options: TomTomSDKRoutePlanner.RoutePlanningOptions, onRouteReady: ((TomTomSDKRoute.Route) -> ())?, completion: @escaping (Result<RoutingResponse, Error>) -> () )
Parameters
options
The
RoutePlanningOptions
with parameters for the requestonRouteReady
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 isRoutingError
-
This function calculates a set of locations that can be reached from the origin point, subject to the available fuel or energy budget that is specified in the
RangeCalculationOptions
.Declaration
Swift
public func calculateRange( options: RangeCalculationOptions, completion: @escaping ( RangeCalculationOptions, Result<ReachableRange, Error> ) -> () )
Parameters
options
The
ReachableRangOptions
objects.completion
The completion closure is called on the main queue after the response to the request has been processed.
RangeCalculationOptions
contains the options passed into thecalculateRange
call. If no errors have occurred,ReachableRange
contains polygon boundaries, each in counterclockwise orientation, and the precise polygon center (the result of map-matching the origin point). -
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<TomTomSDKRoute.Route, Error>
Parameters
options
The
RoutePlanningOptions
. Note: Route ETA should be updated outside [increment] callReturn Value
If the call succeeds, return a Route. If it fails, return an Error.