Map quickstart
This guide will help you set up your project and visualize your first TomTom map in just a few minutes. You’ll learn the minimal steps needed to install the SDK, configure your API key, and display an interactive map on your webpage.
Prerequisites and Setup
Before getting started, ensure you have the following requirements:
- Node.js and npm/pnpm installed for package management (Node.js 22+ recommended)
- TomTom API key from the TomTom Developer Portal
- Modern browser with WebGL support for optimal map rendering performance
Installing Dependencies
Follow the complete Project setup guide for detailed installation instructions, or use this quick setup:
# npm or Yarn - automatic peer dependency installationnpm install @tomtom-org/maps-sdk
# pnpm - enable auto-install-peers for easiest setupecho "auto-install-peers=true" >> .npmrcpnpm install @tomtom-org/maps-sdkPeer dependencies (installed automatically with above commands):
maplibre-gl(v5) - Map rendering enginelodash-es(v4) - Utility functionszod(v4) - Schema validation
MapLibre CSS
The SDK will automatically download the CSS for the MapLibre version you installed.
Otherwise, you can specify the MapLibre CSS in your project if you want to override some maplibre styles with predictable results, or if you need to ensure a different version is used.
If you want to include a specific MapLibre CSS you can do it in two ways:
Import in your JavaScript/TypeScript files (preferred):
import 'maplibre-gl/dist/maplibre-gl.css';Or directly in your HTML file (replace @VERSION with the desired version or omit for latest):
<!-- Include in your HTML head --><link href="https://unpkg.com/maplibre-gl@VERSION/dist/maplibre-gl.css" rel="stylesheet" />Basic HTML Setup
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>TomTom Map Application</title> <style> #map { width: 100%; height: 400px; } </style></head><body> <div id="map"></div> <script type="module" src="./index.ts"></script></body></html>Creating Your First Map
Here’s a complete example that demonstrates all the essential concepts for creating a TomTom map with various configuration options:
import { TomTomConfig } from '@tomtom-org/maps-sdk/core';import { TomTomMap } from '@tomtom-org/maps-sdk/map';
// Configure global SDK settingsTomTomConfig.instance.put({ apiKey: 'YOUR_API_KEY_HERE',});
const map = new TomTomMap({ mapLibre: { container: 'map' }});Next Step
Now that you have a basic map running, learn about TomTom Maps configuration and usage patterns in our comprehensive TomTom Maps Introduction guide.