Quickstart

VERSION 0.2.2822
PUBLIC PREVIEW

The Routing SDK provides the tools to integrate the TomTom Routing API into an iOS application. It is used to calculate a route between an origin and a destination, using a range of options and taking traffic into account. Read more about TomTom’s Routing parameters.

Project set up

To use the Routing SDK, you will need to do the following:

  1. Get your TomTom API key from the Developer Portal. You can find instructions on how to do this at the How do I get a TomTom API Key? page.
  2. Set up the project - Project set up guide.
  3. Add the Routing and the Online Routing module dependencies in the Podfile and install them by executing the pod install command.
    1TOMTOM_SDK_VERSION = '0.2.2822'
    2
    3target 'YourAppTarget' do
    4 use_frameworks!
    5 pod 'TomTomSDKRoutePlannerOnline', TOMTOM_SDK_VERSION
    6 pod 'TomTomSDKRoutePlanner', TOMTOM_SDK_VERSION
    7end
  4. Once the project is set up and both routing modules are added to your target, import the following frameworks:
    import TomTomSDKRoutePlannerOnline

Routing SDK entry point

After all the preparations above, you can initialize the OnlineRoutePlanner object. It is the entry point for performing routing requests.

1init() {
2 self.routePlanner = OnlineRoutePlanner(apiKey: "<ROUTING-KEY>")
3}

You must set the API key before initializing OnlineRoutePlanner:

.

Routing basic usage

The OnlineRouting module can be used to obtain a route between two points. This module has to be used together with the Routing module.

To calculate a route from A to B, you need to provide route planning criteria. They are built using the RoutePlanningOptions class. Once you have a RoutePlanningOptions object, pass it to the planRoute method from the OnlineRoutePlanner object in order to get the result. Read more about routing options and route planning in the Planning a route guide.

For a more advanced navigation experience, you can add optional intermediate locations to the route. Read more about this feature in the Waypoints and custom routes guide.

There are two options for planning a route:

The faster method delivers only the first guidance increment. This guidance increment contains one or more potentially combinable instructions and the corresponding lane guidance.