Geocode service NodeJS

Server-side geocoding service 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 { geocode } from '@tomtom-org/maps-sdk/services';
import { API_KEY } from './config';

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

(async () => {
    const result = await geocode({ query: 'Rue Pepin', limit: 3 });
    console.log(JSON.stringify(result, null, 4));
})();

SDK 1.0.0-rc.7

A street name goes in and the matching addresses come back as GeoJSON, printed by a plain Node process that imports only @tomtom-org/maps-sdk/services.

  • geocode turns free-form text into positioned features, so there is no response parsing or coordinate plucking left to write.
  • The limit option caps the result set at the service, so the trimming happens before the payload crosses the wire.

Related examples