Maps SDK for Web
tt.services.calculateReachableRange
Calculate a reachable range implementation using the TomTom Reachable Range API.
Makes a route request using the TomTom Routing API - Calculate Reachable Range.
Parameters need to be passed to the constructor. The method go performs the actual call.
The Calculate Reachable Range service calculates a set of locations that can be reached from the origin point, subject to the available fuel or energy budget that is specified in the request.
The information returned is a polygon boundary in counterclockwise orientation and the precise polygon center (the result of map-matching the origin point).
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.calculateReachableRange([options])
Example
tt.services.calculateReachableRange({
key: <Your API key>,
origin: '19.454722,51.776667',
fuelBudgetInLiters: 5,
constantSpeedConsumptionInLitersPerHundredkm: ["10,20", "15,30"],
})
.go()
.then(function(rangeData) {
console.log(rangeData.toGeoJson());
})
.catch(function(error) {
console.error(error);
});
Parameters
Name | Description |
---|---|
options
Object default:None |
Options to be passed to the routing call, or an array of such options objects to perform a batch request. |
Methods
go( ): Promise
Executes a predefined asynchronous task using the current configuration.
Returns