To consider traffic within the optimization, you need to specify the following:
"configuration":{
"routing":{
"consider_traffic": true,
"network_data_provider": "tomtom"
}
}
Note that the optimization is daytime-dependent now, i.e. it is important to specify all time-related fields in seconds since Jan 01 1970 (UTC). Along with the coordinates, it is then internally converted into UTC date time with offset (e.g. “2017-09-18T10:12+02:00”). For example, if you want to let your vehicle start today, 18.09., 11am and you are located in Berlin (UTC date time with offset: “2017-09-18T11:00+02:00”) find the according unix timestamp and put it in your vehicle specification like this:
{
"vehicle_id": "my_vehicle",
"start_address": {
"location_id": "berlin",
"lon": 13.406,
"lat": 52.537
},
"earliest_start": 1505725200
}
If traffic should be considered, GraphHopper uses historical traffic data from TomTom to solve the underlying vehicle routing problem.
In the response you will have two additional fields arr_data_time and end_data_time that display UTC time as date time string (e.g. “2017-09-18T11:00+02:00”), e.g.:
{
"type": "service",
"id": "frankfurt",
"location_id": "13.456055_52.517795",
"address": {
"location_id": "13.456055_52.517795",
"lat": 52.517795,
"lon": 13.456055
},
"arr_time": 1505723036,
"arr_date_time": "2017-09-18T10:23:56+02:00",
"end_time": 1505723036,
"end_date_time": "2017-09-18T10:23:56+02:00",
"waiting_time": 0,
"distance": 4910,
"driving_time": 716,
"preparation_time": 0,
"load_before": [
0
],
"load_after": [
0
]
}
It is important to mention that in the alpha phase we only allow the vehicle profile “car” and we only cover Europe. Also the changed copyright notice has to be considered.
See our official documentation for the latest coverage: https://docs.graphhopper.com/#section/Map-Data-and-Routing-Profiles/TomTom