This is the documentation of version 1.0.0-rc.3. Go to the latest version, 1.0.0-rc.5.
TomTom Maps for JavaScript
    Preparing search index...

    Function geocode

    • Converts addresses into geographic coordinates (geocoding).

      The Geocode service translates addresses and place names into geographic coordinates, so you can position markers on maps, calculate routes or perform spatial analysis.

      Parameters

      • params: GeocodingParams

        The geocoding parameters, including the address query.

      Returns Promise<GeocodingResponse>

      The geocoded locations.

      This service is optimized for address lookup and does not return POIs (Points of Interest). For POI search, use the discoverPlaces function instead.

      It is highly tolerant of typos and incomplete addresses, and handles various address formats and components. It supports street addresses, intersections and cross streets, works with higher-level geographies (cities, counties, states, countries) and returns structured address components.

      // Geocode a complete address
      const result = await geocode({
      query: '1600 Pennsylvania Avenue NW, Washington, DC'
      });

      // Geocode with partial address
      const partialResult = await geocode({
      query: 'Amsterdam, Netherlands'
      });

      // Geocode with bias towards specific location
      const biasedResult = await geocode({
      query: 'Main Street',
      geoBias: { position: [4.9041, 52.3676] }, // Bias toward Amsterdam
      limit: 5
      });

      // Geocode an intersection
      const intersection = await geocode({
      query: '5th Avenue & 42nd Street, New York'
      });