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

Coordinates

The SDK takes a location in several shapes (HasLngLat): a [longitude, latitude] array, a GeoJSON Point or a Point feature such as a place. getPosition turns any of them into a plain [longitude, latitude].

getPosition

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

getPosition([4.9, 52.3]);                             // [4.9, 52.3]
getPosition({ type: 'Point', coordinates: [4.9, 52.3] }); // [4.9, 52.3]

const place = await geocodeOne('Amsterdam Centraal');
getPosition(place);                                   // the place's geometry coordinates

// The main entrance, when the place has one; its geometry otherwise
getPosition(place, { useEntryPoint: 'main-when-available' });