Maps SDK for Web
tt.services.crossStreetLookup
It converts geographical coordinates into a textual address representation using the TomTom Search API - CrossStreet lookup.
Parameters need to be passed to the constructor.
Response
The final response from the service is a JSON object with the following structure:
{
address: {
buildingNumber: 19,
streetNumber: 19,
street: 'N 2nd St',
streetName: 'N 2nd St',
crossStreet: 'E SANTA CLARA ST'
streetNameAndNumber: '',
speedLimit: '',
countryCode: 'US",
countrySubdivision: "'A',
countrySecondarySubdivision: 'Santa Clara',
countryTertiarySubdivision: '',
municipality: 'San Jose',
postalCode: '95113',
municipalitySubdivision: "San Francisco Bay Area',
freeformAddress: 'E SANTA CLARA ST & N 2nd St, San Jose, CA, 95113'
},
position: {
lng: -121.8898',
lat: '37.337083
}
}
The response is also extended with getTrackingId()
method, which returns the Tracking-ID
associated with the request.
Please refer to Difference between API responses and this library's responses section.
In order to make a batch call, pass an object containing the following properties:
- 'key' - valid API Key for the used service
- 'batchMode' - valid options: sync, async, or redirect
- 'waitTimeSeconds' - maximum waiting time for batch download response. This option only works with 'async' and 'redirect' batch modes. Accepts 120 or an integer between 5 and 60.
- 'batchItems' - array of objects with options for each call.
For more information, please refer to the batch documentation: Routing, Search.
tt.services.<service name>({
batchMode: 'sync'
key: <Your API key>,
batchItems: [{
...
}, {
...
} //... more objects
]
}).then(callback);
Constructor
tt.services.crossStreetLookup([options], [additionalOptions])
Example
tt.services.crossStreetLookup({
key: <Your API key>,
position: '19.449,51.759'
}).then(function(response) {
console.log(response);
});
Parameters
Name | Description |
---|---|
options
Object default:None |
|
additionalOptions
Object default:None |
Additional options to be passed to the service. |
additionalOptions.abortSignal
Object default:None |
Signal created with abortController. Use AbortController to cancel requests in progress. Example
|
options.allowFreeformNewline
Boolean default:None |
Format of newlines in the formatted address. If true, the address will contain newlines (line breaks). Otherwise, newlines will be converted to spaces. |
options.heading
Number default:None |
The directional heading of the vehicle in degrees for travel along a
segment of roadway.
Makes it possible to get the address information of the road, keeping in mind the direction. |
options.key
String default:None |
A valid API Key for the requested service. 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 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. |
options.position
String | Number[] | String[] | Object default:None |
Longitude and latitude data in one of the supported formats. This option's value should have the location to be reverse geocoded. This option is able to convert a number of popular formats into a geographic coordinate. The supported formats are listed below:
|
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. |
options.radius
Number default:None |
A positive integer value in meters. This option specifies the search radius in meters using the coordinates given to the center
option as origin.
|
options.trackingId
String default:uuid |
Sets value of "Tracking-ID" header. Specifies an identifier for the request. If not set by the user, UUID is generated for each call.
|
options.view
String default:None |
Geopolitical view. Can be one of "Unified", "AR", "IN", "PK", "IL, "MA", "RU", "TR" and "CN". Legend:
|