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

GuideCovers
Discover placesFuzzy, geometry and along-route search, filters, pagination
Search suggestionsPlaces, brands and categories for a search box
Place detailsA place’s full details by its ID
POI categoriesThe category codes, found by name or synonym
GeocodingAddresses to coordinates
Reverse geocodingCoordinates to an address
Geometry dataThe outlines of areas

Map integration