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...

    Type Alias GeocodingParams

    GeocodingParams: Omit<
        CommonPlacesParams<GetObject, GeocodingResponseAPI> & CommonGeocodeAndFuzzySearchParams,
        "extendedPostalCodesFor",
    > & {
        extendedPostalCodesFor?: GeocodingIndexTypesAbbreviation[];
        filters?: GeographicFilters & Pick<PlaceFilters, "geographyTypes">;
        query: string;
    }

    Parameters for geocoding addresses into geographic coordinates.

    Geocoding converts human-readable addresses into latitude/longitude coordinates, so you can place markers on maps or perform spatial operations.

    Type Declaration

    • OptionalextendedPostalCodesFor?: GeocodingIndexTypesAbbreviation[]

      Indexes for which extended postal codes should be included in the results.

      Extended postal codes provide additional postal code detail for addresses. By default, they are included for all indexes except geographic areas (Geo).

      The available index types are:

      • PAD: Point Address
      • Addr: Address Range
      • Str: Street
      • XStr: Cross Street
      • Geo: Geography

      Geographic areas (Geo) can have very long postal code lists, so you must request them explicitly when needed.

      All indexes except Geo
      
      // Include extended postal codes for addresses only
      extendedPostalCodesFor: ['PAD', 'Addr']

      // Include for all indexes including geographies
      extendedPostalCodesFor: ['PAD', 'Addr', 'Str', 'XStr', 'Geo']
    • Optionalfilters?: GeographicFilters & Pick<PlaceFilters, "geographyTypes">

      Where results may come from. Every filter here excludes results.

      It combines GeographicFilters with geographyTypes, which restricts the kinds of geography that come back. Geocoding has no POI notion, so the rest of PlaceFilters does not apply.

      filters: { countries: ['NL'], geographyTypes: ['Municipality'] }
      
    • query: string

      Address or location query to geocode.

      The text to convert into geographic coordinates, typically a street address, intersection, city name or landmark. The service tolerates typos and incomplete inputs. Pass it as plain text. The SDK encodes it for the request path, so a value you already encoded is encoded again and can resolve to a different place.

      Query examples:

      • Full street address: "1600 Pennsylvania Avenue NW, Washington, DC"
      • City name: "Amsterdam"
      • Intersection: "Broadway & 42nd St, New York"
      • Landmark: "Eiffel Tower, Paris"
      • Partial address: "Dam Square" (city context resolved via geoBias or filters.countries)
      query: '1600 Pennsylvania Avenue NW, Washington, DC'
      query: 'Museumplein, Amsterdam'
      query: 'Buckingham Palace, London'

    This service is optimized for address lookups and does not return POIs. For POI search, use discoverPlaces instead.

    It tolerates typos and incomplete addresses, handles various address formats and supports street addresses, intersections and cross streets. It works with geographies (cities, counties, states, countries) and returns structured address components.

    // Geocode a complete address
    const params: GeocodingParams = {
    query: '1600 Pennsylvania Avenue NW, Washington, DC'
    };

    // Geocode with bias toward a location
    const biasedParams: GeocodingParams = {
    query: 'Main Street',
    geoBias: { position: [4.9041, 52.3676] }, // Bias toward Amsterdam
    limit: 5
    };