This is the documentation of version 0.64.0. Go to the latest version, 1.0.0-rc.5.

Core quickstart

The Core bundle (@tomtom-org/maps-sdk/core) holds what the Map and Services bundles share: the global configuration, the place and route types, and utilities for coordinates, bounding boxes, formatting and routes.

Installing dependencies

Core ships inside the one SDK package, so installing the SDK installs it:

npm install @tomtom-org/maps-sdk

Core needs lodash-es and @turf/turf as peer dependencies; the project setup guide lists every bundle's and how pnpm installs them.

Common configuration

Set the API key once at startup; every map and service call reads it from there:

import { TomTomConfig } from '@tomtom-org/maps-sdk/core';

TomTomConfig.instance.put({
    apiKey: 'YOUR_API_KEY',
    language: 'en-GB'
});

Before you ship, decide where this key will live. A key used from the browser can be read by anyone who opens the page. A key used from Node.js cannot. See Where your API key runs for which case you are in and what to do about it, and TomTom's API key management best practices for key restrictions, rotation and monitoring.

Every option, how a map or a single call overrides it, and the Node.js setup are in the global configuration guide.

Using with map bundle

import { TomTomConfig } from '@tomtom-org/maps-sdk/core';
import { TomTomMap } from '@tomtom-org/maps-sdk/map';

TomTomConfig.instance.put({ apiKey: 'YOUR_API_KEY' });

const map = new TomTomMap({ mapLibre: { container: 'map' } });

Next: the map quickstart.

Using with services bundle

import { TomTomConfig } from '@tomtom-org/maps-sdk/core';
import { discoverPlaces } from '@tomtom-org/maps-sdk/services';

TomTomConfig.instance.put({ apiKey: 'YOUR_API_KEY' });

const results = await discoverPlaces({
    query: 'restaurants',
    geoBias: { position: [4.9041, 52.3676] }
});

Next: the services quickstart.