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 otherwisegetPosition(place, { useEntryPoint: 'main-when-available' });useEntryPoint-'ignore'(the default) returns the feature’s geometry.'main-when-available'returns the position of the place’smainentry point if it has one.- Returns
Position | null:nullfor an input that holds no position.