Traffic details only in the route not from all roads in the bounding box

How to fetch traffic incident details in the best route between two coordinates lets say source and the destination. I have seen the usage of Traffic incident api which gives the traffic details in all the roads present inside the bounding box. we would need to retrieve traffic incident details only in the best route between two points.

Hi.

You can try to use a couple of traffic-related parameters (especially the sectionType=traffic parameter) in your routing call which is described in the documentation: https://developer.tomtom.com/routing-api/routing-api-documentation-routing/calculate-route. It’ll add a basic information of traffic type and delays for a particular route.
Example call: https://api.tomtom.com/routing/1/calculateRoute/52.3682540753648,4.892619882275255:52.37287873775716,4.893145595243112/json?sectionType=traffic&computeTravelTimeFor=all&traffic=true&key=YOUR_API_KEY

Regards,
Mateusz

Thanks Mateusz for the quick response! Providing section type as traffic still retrieves only route details and the estimated time of travel details. I am looking for traffic data something similar or same as what we get from traffic api but only between two points. Is it possible from traffic api??

Hi!

It not only retrieves route details or speeds…
You can also get data like type of traffic incident, effective speed and more. Example response fields:


If it’s not enough data, you can still use traffic API, however, Incidents Details API works with a bounding box, so you are limited to get incidents for a particular rectangle of the map. There is also the Flow Segment Data API which you can use for a route legs points which you have got from routing response.

Regards,
Mateusz

1 Like