Route ETA
Route ETA
This endpoint will return route ETA information. We based the options for this end point on the same JSON configuration options that are present in our JavaScript API. The Online Routing (legacy) engine provides a huge number of tunable options for generating the optimal route. All the tunable options related to maneuvers will be ignored as they are not relevant to the ETA summary.
To send the criteria you can either use GET request with the JSON as a string value for the criteria parameter, e.g.:
GET
?criteria={"distanceUnit":"FT","routePreference":"Pedestrian", ... }
Optionally use POST request with criteria in the request body. Example request body for a POST request is as follows:
POST
{
"origin":[
"37.78900219348633,-122.39112854003905",
"37.820023,-122.478443"
],
"destination":[
"37.79962738517166,-122.41584777832033"
],
"criteria":{
"trafficEnabled":true
}
}
The attributes 'origin' and 'destination' are arrays, *atleast* one of them has to contain only one point.
A maximum of 10 points can be passed in either origin or destination arrays.
The route ETAs can only be returned for the following:
1. One origin to multiple destinations
2. Multiple origins to one destination
Request
Format
Route ETA between two points:
GET https://<baseURL>/routing/<versionNumber>/route/eta/<from>/<to>.<ext>?key=<apiKey>[&criteria=<criteria>]
POST https://<baseURL>/routing/<versionNumber>/route/eta.<ext>?key=<apiKey>
The table below describes all of the parameters that can be used in a request. Required parameters must be used or the call will fail. Optional parameters, which are highlighted with [square brackets], may be used. If there is a default value that will be assumed when an optional parameter is not used, it is shown in the table. The order of request parameters is not important.
Parameter | Description | Req'd? | Type / Values | Default Value | Max Value |
---|---|---|---|---|---|
baseURL | Base URL for calling the API. | Yes | api.tomtom.com | — | — |
versionNumber | Service version number.The current value is 0. | Yes | 0 | — | — |
from
|
This is specified as a comma separated string composed by lat., lon. (e.g.: 37.337,-121.89). *Must be removed for POST request* |
Yes | Position | — | — |
to
|
This is specified as a comma separated string composed by lat, lon (e.g.: 37.337,-121.89). *Must be removed for POST request* |
Yes | Position | — | — |
ext
|
Valid response formats are JSON, JSONP, JS or XML. | Yes | String | — | — |
apiKey
|
Your TomTom API key. | Yes | String | — | — |
[criteria] | This is a JSON serialized deCarta.Core.RouteCriteria object (see our JavaScript API). Its structure is described below (Defaults are marked with '*''): | No | JSON Object | — | — |
{ //Unit for distance measurement. distanceUnit: ["KM","M","FT",*"MI"], //Provide a Route ID provideRouteID: [true, *false], //The directional heading of the vehicle in degrees, for travel along a segment of roadway. 0 is North, 90 is East and so on, values range from -360 to 360. The precision can include upto one decimal place. heading: 0, /* Routing Style Fastest: Computes the least cost route, considering road class. Easy: Computes a fast route that avoids turns. NoFreeways: Computes a route without considering limited acccess roads (Freeways/Highways/Motorways) MoreFreeways: Favors freeways even if less costly routes are available. AvoidFreeways: Assigns a high cost to travel on limited access roads, so that they are used only if necessary to find a route. Pedestrian: Computes a pedestrian route. Shortest: Computes the shortest route without considering turns or the road class. */ routePreference: [*"Fastest", "AvoidFreeways", "Easy", "MoreFreeways", "NoFreeways", "Pedestrian", "Shortest"], /* Array of waypoints to route through. (defaults to an empty array). The maximum number of waypoints that can be passed in is 10. If they have to be optimized the limit goes down to 5 */ waypoints: ["lat,Lon"], //If enabled, the route will consider live traffic conditions trafficEnabled: [true, *false], /* Specify an arrival time or departure time for the route to take into consideration, it will make use of historic traffic patterns when these attributes are passed in. Works only when 'trafficEnabled' is set to 'true'. If both arrival and departure are present, api defaults to using arrivalTime. */ arrivalTime: YYYY-MM-DDTHH:mm, departureTime: YYYY-MM-DDTHH:mm, /* Array of serialized shapes. The route will avoid intersecting these areas. Ex: {"type":"POLYGON","vertices":["37.75241,-122.43576","37.70660, -122.43301","37.71205,-122.36434"]} {"type":"CIRCLE","position":"44.99362,-74.08582", "radius":"300"} //radius in meters {"type":"POLYLINE", "lineGeometry": ["37.75241,-122.43576", "37.70660,-122.43301"]} Currently only a Polygon (deCarta.Core.Polygon), Circle (deCarta.Core.Circle) and Polyline (deCarta.Core.Polyline)can be passed in for avoidance. */ avoidAreas: [], //Road types to avoid. Defaults to empty array avoidList:["ferry", "toll", "tunnels", "bridges", "skyway", "unpavedroad", "limitedaccess"] //Adjusting costs for the above avoidList. The following parameter can only be passed in together with the avoidList. //Ex: If 'toll' is pased in the avoidList, a corresponding cost can be passed in the adjustCost object. {"toll":10}. //The cost can either be a float number or a string 'INF' which assigns infinite cost. //If adjustCost is not passed in the defualt cost will be set to 'INF' for the avoidList adjustCost: {}, //Number of alternate routes to return alternateRoutes: 0, //If set to true, waypoints will be rearranged in optimal order. optimized: false, } |
Response
Format
Response for a json object, will have the following structure:
{ "routeETAs": [ { "routeId": "2be6cc2407354b6f8d01f82bbdd61338", "originalRouteId": "5D00000078563412000000005D0000005F1ADF42A8F75A00E603BE2D5D2CACEA0197B74517E4880BA0001345485A2CE174B2B300963F4A0186FE9CA5E3974B2AEC00A22949BDFE5A9877C5D2CABA00334973FF5AA186AD00E85F3FDD59DFFEF800", "routeSummary": { "totalDistance": { "value": 1.9911, "uom": "MI" }, "totalTime": "P0DT0H5M15S", "destination": { "lat": 37.79962, "lon": -122.41584 }, "origin": { "lat": 37.7889, "lon": -122.39126 } } }, { "routeId": "9c6fd48611e9014c90a666caa128c1fb", "originalRouteId": "7F00000078563412000000007F0000005F1AE4ECA8E77600E43B2B40C5D2CA820597E74A0280FF2D2C5D2CA829042C456BD8A5F2A0287846FF7A4ABA27E174B2A002B9CA4AFAB901D9BA04974B2A1000BD1649B40109BD8EA10AB87349CF0336B8CFA20881A049E203D5B178974B2AEA00B1A445821A819BA100E0633A955945021400", "routeSummary": { "totalDistance": { "value": 7.144, "uom": "MI" }, "totalTime": "P0DT0H12M42S", "destination": { "lat": 37.79962, "lon": -122.41584 }, "origin": { "lat": 37.82001, "lon": -122.47856 } } } ] }