Places quickstart

The places services find places by text, area or route, turn addresses into coordinates and back, and return each result as a GeoJSON place that the Places module shows without mapping fields first.

Basic setup

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

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

The global configuration also sets the language and geopolitical view that every call inherits. A single call can override them.

Quick examples

Search for places

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

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

console.log(results.features[0].properties.poi?.name);

Geocode an address

import { geocodeOne } from '@tomtom-org/maps-sdk/services';

const place = await geocodeOne('Dam Square, Amsterdam');
const coordinates = place.geometry.coordinates; // [lng, lat]

Reverse geocode coordinates

import { reverseGeocode } from '@tomtom-org/maps-sdk/services';

const place = await reverseGeocode({ position: [4.9041, 52.3676] });
console.log(place.properties?.address?.freeformAddress);

Next steps

Guide Covers
Discover places Fuzzy, geometry and along-route search, filters, pagination
Search suggestions Places, brands and categories for a search box
Place details A place's full details by its ID
POI categories The category codes, found by name or synonym
Geocoding Addresses to coordinates
Reverse geocoding Coordinates to an address
Geometry data The outlines of areas

Related guides and examples

Related examples

Map integration