Maps SDK for Web
tt.services.alongRouteSearch
Makes a search request using the TomTom Search API - Along Route Search.
The Search Along Route endpoint allows you to perform a fuzzy search for POIs along a specified route. This search is constrained by specifying the Detour Time limiting measure.
To send the route points, this service will use a POST request with the route encoded as a JSON payload. The minimum number of route points is 2.
Parameters need to be passed to the constructor. The method go performs the actual call.
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.alongRouteSearch([options])
Example
tt.services.alongRouteSearch({
key: <Your API key>,
limit: 20,
maxDetourTime: 120,
query: 'gas station',
route: [
{
'lat': 37.7524152343544,
'lon':-122.43576049804686
},
{
'lat': 37.70660472542312,
'lon':-122.43301391601562
},
[-122.36434936523438, 37.712059855877314], // Another valid format
]
})
.go()
.then(function(response) {
console.log('SUMMARY:');
console.table(response.summary);
console.log('RESULTS:');
console.table(response.results);
});
For a list of all available formats for routes, read the documentation for the route option.
Parameters
Name | Description |
---|---|
options
Object default:None |
Methods
go( ): Promise
Executes a predefined asynchronous task using the current configuration.
Returns