SDKs overview

TomTom provides software development kits (SDKs) to facilitate the integration of its mapping and location services into various applications. These SDKs abstract the complexities of direct API calls, offering pre-built components and functionalities tailored for specific development environments. The primary SDKs support web, Android, and iOS platforms, aligning with common application development needs for location-based services and geospatial data integration.

Developers utilize these SDKs to access core TomTom services, including the Maps API for displaying interactive maps, the Traffic API for real-time traffic information, and the Routing API for calculating routes. The SDKs are designed to streamline the implementation of features like geocoding, search, and custom map styling, enabling developers to focus on application-specific logic rather than low-level API interactions. For a comprehensive overview of all available APIs and their documentation, developers can refer to the TomTom Maps API documentation.

Official SDKs by language

TomTom offers official SDKs for the most prevalent development platforms, ensuring broad compatibility and support for developers building web and mobile applications. Each SDK is optimized for its respective environment, providing native-like performance and integration capabilities.

Platform/Language SDK Name Package Manager/Method Maturity
Web (JavaScript) TomTom Maps SDK for Web npm, CDN Stable
Android (Java/Kotlin) TomTom Maps SDK for Android Gradle Stable
iOS (Swift/Objective-C) TomTom Maps SDK for iOS CocoaPods, Swift Package Manager Stable

The TomTom Maps SDK for Web is a JavaScript library designed for embedding interactive maps into web pages. It provides functionalities for map display, markers, popups, and event handling, making it suitable for a wide range of web-based mapping applications. For mobile development, the TomTom Maps SDK for Android and TomTom Maps SDK for iOS offer native components for integrating TomTom maps and services into Android and iOS applications, respectively. These mobile SDKs support features like custom map styles, location tracking, and route visualization, optimized for mobile performance and user experience.

Installation

Installation methods vary depending on the chosen SDK and target platform. Developers typically use platform-specific package managers or include the SDK directly via a Content Delivery Network (CDN) for web projects.

Web SDK (JavaScript)

For web applications, the TomTom Maps SDK for Web can be installed via npm or included directly via a CDN link in an HTML file.

Using npm:

npm install @tomtom-international/web-sdk-maps

Using CDN (in HTML <head>):

<link rel='stylesheet' type='text/css' href='https://api.tomtom.com/maps-sdk-for-web/cdn/6.x.x/maps/maps.css'/>
<script src='https://api.tomtom.com/maps-sdk-for-web/cdn/6.x.x/maps/maps-web.min.js'></script>

Replace 6.x.x with the latest stable version of the Web SDK as indicated in the official documentation.

Android SDK (Java/Kotlin)

For Android development, the TomTom Maps SDK for Android is integrated using Gradle. Add the following to your project's build.gradle file:

Add Maven repository:

allprojects {
    repositories {
        google()
        mavenCentral()
        maven {
            url "https://api.tomtom.com/maven"
        }
    }
}

Add dependency to app's build.gradle:

dependencies {
    implementation 'com.tomtom.sdk.maps:map-display:0.xx.x' // Replace with latest version
}

Consult the TomTom Maps SDK for Android latest release notes for the current version number.

iOS SDK (Swift/Objective-C)

For iOS applications, the TomTom Maps SDK for iOS can be installed using CocoaPods or Swift Package Manager.

Using CocoaPods (in your Podfile):

target 'YourAppTarget' do
  use_frameworks!
  pod 'TomTomSDKMaps' # Or specific modules like 'TomTomSDKMapDisplay'
end

Then run pod install. Refer to the TomTom Maps SDK for iOS documentation on CocoaPods integration for specific module names and versions.

Using Swift Package Manager:

In Xcode, navigate to File > Add Packages... and enter the repository URL: https://github.com/tomtom-international/tomtom-sdk-maps-ios. Select the desired packages and version rule.

Quickstart example

The following example demonstrates how to initialize a basic map using the TomTom Maps SDK for Web. This snippet creates a map centered on a specific location with a zoom level.

Web SDK Quickstart (JavaScript)

This example assumes you have an API key from the TomTom Developer Portal and a <div id="map"></div> element in your HTML.

<!DOCTYPE html>
<html>
<head>
    <title>TomTom Map Quickstart</title>
    <meta charset='utf-8'/>
    <meta name='viewport' content='width=device-width, initial-scale=1, shrink-to-fit=no'/>
    <link rel='stylesheet' type='text/css' href='https://api.tomtom.com/maps-sdk-for-web/cdn/6.x.x/maps/maps.css'/>
    <script src='https://api.tomtom.com/maps-sdk-for-web/cdn/6.x.x/maps/maps-web.min.js'></script>
    <style>
        #map {
            height: 500px;
            width: 100%;
        }
    </style>
</head>
<body>
    <div id='map'></div>
    <script>
        tomtom.set=-'YOUR_API_KEY'; // Replace with your TomTom API key

        var map = tomtom.map({
            key: 'YOUR_API_KEY', // Replace with your TomTom API key
            container: 'map',
            center: [4.899431, 52.379189],
            zoom: 10
        });
    </script>
</body>
</html>

This code initializes a map centered on Amsterdam (longitude 4.899431, latitude 52.379189) with a zoom level of 10. Remember to replace 'YOUR_API_KEY' with your actual TomTom API key obtained from your developer dashboard.

Community libraries

While TomTom provides robust official SDKs, the developer community also contributes to the ecosystem by creating libraries and wrappers that extend functionality or simplify integration with specific frameworks. These community-driven projects can offer alternative approaches or specialized tools not covered by the official offerings.

Examples of community contributions often include:

  • Framework-specific wrappers: Libraries that integrate TomTom services more seamlessly with popular JavaScript frameworks like React, Angular, or Vue.js. These might provide components or hooks that align with the framework's architecture.
  • Utility functions: Smaller libraries that handle common tasks such as coordinate conversions, advanced marker clustering, or custom UI elements that build on top of the core SDKs.
  • Language bindings: While official SDKs cover primary languages, community projects might emerge for less common languages or specific runtime environments.

Developers seeking community-supported tools should explore platforms like GitHub, Stack Overflow, or developer forums dedicated to TomTom APIs. For instance, searching for "TomTom React component" or "TomTom Flutter plugin" on GitHub may yield relevant projects. It is important to note that community libraries may not carry the same level of official support or stability as the SDKs provided directly by TomTom. Developers should review the project's documentation, community activity, and licensing before incorporating them into production applications.

For official support and the most up-to-date features, it is always recommended to prioritize the official TomTom SDKs and documentation. For general guidance on choosing between official and community libraries, resources like the MDN Web Docs definition of a library can provide context on their role in development.