OnlineRangeCalculator

public final class OnlineRangeCalculator : RangeCalculator

The Online Range Calculator 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

  • Initializer.

    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. Without the endpoint, as String. An example: “https://api.tomtom.com/routing/1”. The base URL should support the endpoint “calculateReachableRange”.

    apiKey

    A valid TomTom Service API Key.

Public

  • 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.

    Important

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

    Declaration

    Swift

    public func calculateRange(
        options: RangeCalculationOptions,
        completion: @escaping (
            Result<Range, Error>
        ) -> ()
    )

    Parameters

    options

    The RangeCalculationOptions 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 the calculateRange 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).

  • Cancels all current requests.

    Important

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

    Declaration

    Swift

    public func cancelPendingRequests()