Share via

Get traffic delay between two points

Gilbert Tanner 1 Reputation point
2022-06-07T08:09:49.44+00:00

Hi,

I'm currently working on implementing a system to display traffic data between two coordinate points and wanted to try the Traffic API for this. I used it to get the traffic data by specifying a single coordinate like:

https://atlas.microsoft.com/traffic/flow/segment/json?&subscription-key=<key>&api-version=1.0&style=absolute&zoom=10&query=46.632322,14.241908

This tries to find the road segment in question itself, but that's not what I need. Instead, I want to define the start and end of the segment myself and get the traffic data between the two coordinate points in question. What are my options to implement this behavior?

Any help is greatly appreciated.

Azure Maps
Azure Maps

An Azure service that provides geospatial APIs to add maps, spatial analytics, and mobility solutions to apps.


1 answer

Sort by: Most helpful
  1. rbrundritt 21,711 Reputation points Volunteer Moderator
    2022-06-07T16:05:26.743+00:00

    You can use the routing service and request the traffic section type be included. This will provide the details of the traffic along the route path. This would work for two points on the same street, or multiple points along a complex route (so one solution for all). For example: https://atlas.microsoft.com/route/directions/json?api-version=1.0&query=48.855361,2.346233:52.50274,13.43872&subscription-key=

    Note that this will tell which sections of the route have traffic situations along them, such as traffic jams. If there is not traffic event, then there won't be any traffic details returned, other than the travel time with respect to traffic.

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.