Bing Maps ItineraryItems Duration Includes Traffic

Tom 26 Reputation points
2025-07-25T13:02:39.0533333+00:00

I'm using the Bing Maps REST API to calculate a route. I've noticed that the duration of the itinerary items do not match the travelDuration on the top level resource field but they do match the travelDurationTraffic.

The request includes the optimize=time parameter which the documentation says "The route is calculated to minimize the time. Traffic information is not used.".

Looking through the documentation about the Route Data, I'm under the impression that the travelDuration value should correspond to the duration without traffic.

The travelDuration values for both the RouteLeg and the Route Sub-Leg fields add up to the travelDuration on the top level. The travelDuration on the itinerary items add up to the travelDurationTraffic on the top level.

Is there a parameter that needs to be set to change the itinerary item's travel duration to not include traffic?

Azure Maps
Azure Maps
An Azure service that provides geospatial APIs to add maps, spatial analytics, and mobility solutions to apps.
{count} votes

1 answer

Sort by: Most helpful
  1. rbrundritt 21,191 Reputation points Microsoft Employee Moderator
    2025-07-28T19:07:26.6533333+00:00

    A route calculated with timeWithTraffic will use real time traffic data for the first part of the route (~15 min) and then use predictive traffic data for the second part of the route. Traffic data is updated every minute globally in Bing and Azure Maps, so making a second call to the service could easily result in different numbers. The travelDuration property should be fairly constant as it's based on historical traffic data, while travelDurationTraffic will change relative to real time traffic changes. When you set optimize to anything other than timeWithTraffic the travelDurationTraffic value should be ignored. When you provide a future date, only predictive traffic data is used. Calculations on predictive data can vary every time a calculation is done due to how the calculations are done and the nature of the data. The calculations for routing use a genetic heuristic algorithm. These algorithms are fast and return reasonable results but might not be the 100% best result (maybe 99% best). Every time one of these calculations are done you can get a slightly different calculation. The main reason for doing the routing calculations this way is that the alternative is to brute force the calculations to determine the optimal result, and on a global scale, that could take years to calculate.

    The travelDuration number is able to stay consistent as Bing/Azure Maps has an optimization that precalculated the brute force optimized solution that works with static data (e.g. no traffic data). As such, that absolute optimized path is calculated without any genetic heuristic algorithms. When traffic data is used, this optimization can't be used as we can't pre-calculate every possible combination of routes taking into consideration a metric on each road section that updates every minute. Even doing this on future predicted data would take a long time and require massive amounts of storage (Note that predictive traffic data is unique to each day and time, and not a constant value).


Your answer

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