Maps SDK for Web

tt.services.structuredGeocode

Makes a request using the TomTom Search API - Structured Geocode.

Parameters can be passed to the constructor or provided via convenient methods that can be chained until the method go performs the actual call.

The call is asynchronous, therefore the user has two options to receive the response:

  • Passing a callback function.
  • Use the Promise returned by the go method to handle the response.

The SDK provides a Promise polyfill for browsers (IE<9) without native ECMAScript 6 support.

Constructor

tt.services.structuredGeocode([options])

Example
function callbackFn(result) {
  console.log(result);
};
tt.services.structuredGeocode({
  key: <Your API key>,
  countryCode: 'GB'
})
  .go();
Parameters
Name Description
options
Object
default:None
Options to be passed to the structured geocoding call, or an array of such options objects to perform batch request.
options.callback
Function
default:None
Callback function to use in case of success.
options.fail
Function
default:default
Callback function to use in case of failure.
options.protocol
"http" | "https"
default:"https"
The protocol's type.
options.bestResult
Boolean
default:false
Return only one result, the best match result.
options.countryCode
String
default:None
2 or 3 country code letters (e.g., FR,ES). This option is required to be defined here or by using the countryCode method.
options.limit
Number
default:10
Maximum number of responses that will be returned.
options.offset
Number
default:0
Starting offset of the returned results within the full result set.
options.streetNumber
String
default:None
Street Number.
options.streetName
String
default:None
Street name.
options.crossStreet
String
default:None
Cross street name.
options.municipality
String
default:None
Municipality (city/town).
options.municipalitySubdivision
String
default:None
Municipality subdivision (sub/super city).
options.countryTertiarySubdivision
String
default:None
Named area.
options.countrySecondarySubdivision
String
default:None
County.
options.countrySubdivision
String
default:None
State or province.
options.postalCode
String
default:None
Zip or postal code.

Methods

go( ): Promise

Executes a predefined asynchronous task using the current configuration.

Returns