Reverse geocoding service NodeJS

Server-side reverse geocoding with NodeJS implementation

CodeSandbox is a third-party service and may use cookies to see your IP address and browser info. Cookie notice

View on GitHub
import { TomTomConfig } from '@tomtom-org/maps-sdk/core';
import { reverseGeocode } from '@tomtom-org/maps-sdk/services';
import { API_KEY } from './config';

TomTomConfig.instance.put({ apiKey: API_KEY });

(async () => {
    const response = await reverseGeocode({ position: [5.72884, 52.33499] });
    console.log(JSON.stringify(response, null, 4));
})();

SDK 1.0.0-rc.7

A longitude/latitude pair goes into a plain Node process, and the address at that point prints as typed GeoJSON, ready to forward to a client unchanged.

  • reverseGeocode resolves a raw coordinate into an addressed feature, so no nearest-neighbour pass of your own is involved.
  • Its position argument is [longitude, latitude], the GeoJSON order every call in @tomtom-org/maps-sdk/services takes, so nothing needs swapping between calls.

Related examples