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:
The SDK provides a Promise polyfill for browsers (IE<9) without native ECMAScript 6 support.
In order to make batch call, pass an object which will contain the 'key' property, 'batchMode' property set to the correct value (sync, async, or redirect) and batchItems, which will contain an array of objects which represent options for each call. For more information, please refer to batch documentation:
tt.services.<service name>({
batchMode: 'sync'
key: <Your API key>,
batchItems: [{
...
}, {
...
} //... more objects
]
})
.go()
.then(callback);
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. |
options.bestResult
Boolean default:false |
Defines whether the geocode service should return the best result. It makes the service instances to return only one result, the best match result. This option overwrites both limit and offset parameters. It changes the response from an array to a single result. |
countryCode
String default:None |
2 or 3 country code letters. Sets or returns the value of the countryCode option.
Represents the country's code.
|
countrySecondarySubdivision
String default:None |
County's name. Sets or returns the value of the countrySecondarySubdivision option.
Represents the county's name for the structured address.
|
countrySubdivision
String default:None |
State or province. Sets or returns the value of the countrySubdivision option.
Represents the state or province's name for the structured address.
|
countryTertiarySubdivision
String default:None |
Name of the area. Sets or returns the value of the countryTertiarySubdivision option.
Represents the area's name for the structured address.
|
crossStreet
String default:None |
Cross street's name. Sets or returns the value of the crossStreet option.
Represents the cross street's name for the structured address.
|
options.key
String default:None |
A valid API Key for the requested service. A valid API Key is required to make use of the given service. It can be issued in the Developer Portal. |
options.language
String default:null |
Language code that decides in which language the search results should be returned. The value should correspond to one of the supported IETF language codes. The list is available here. The code is case insensitive. |
options.limit
Number default:10 |
The maximum number of responses that will be returned. Represents the maximum number of responses that will be returned per request. The maximum value is 100. |
municipality
String default:None |
Municipality's name (city/town). Sets or returns the value of the municipality option.
Represents the municipality (city/town) for the structured address.
|
municipalitySubdivision
String default:None |
Municipality subdivision (sub/super city). Sets or returns the value of the municipalitySubdivision option.
Represents the municipality subdivision (sub/super city) for the structured address.
|
options.offset
Number default:None |
A positive integer value. Use this option if you want to apply an offset to the results returned by the Search API service. It makes use of the ofs parameter which allows paginated results when used with the limit option. The maximum value is 1900. |
postalCode
String default:None |
Zip or postal code. Sets or returns the value of the postalCode option.
Represents the zip code or postal code for the structured address.
|
options.protocol
"http" | "https" default:"https" |
The protocol type to be used in the calls. Represents the type of protocol used to perform a service call. |
streetName
String default:None |
Street's name. Sets or returns the value of the streetName option.
Represents the street's name for the structured address.
|
streetNumber
String default:None |
Street's number. Sets or returns the value of the streetNumber option.
Represents the street's number for the structured address.
|
Methods
go( ): Promise
Executes a predefined asynchronous task using the current configuration.
Returns