Back to all examples

Geometry search service NodeJS

Server-side geometry search with NodeJS implementation

import { TomTomConfig } from '@tomtom-org/maps-sdk/core';
import { search } from '@tomtom-org/maps-sdk/services';
import { API_KEY } from './config';

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

(async () => {
    const response = await search({
        query: 'cafe',
        geometries: [
            {
                type: 'Polygon',
                coordinates: [
                    [
                        [-122.43576, 37.75241],
                        [-122.43301, 37.7066],
                        [-122.36434, 37.71205],
                        [-122.37396, 37.7535],
                    ],
                ],
            },
        ],
    });
    console.log(JSON.stringify(response, null, 4));
})();

Related examples