Marco Hokke
Marco Hokke

Reputation: 1

On what is the 'recommended' route based that the Google Distance Matrix API returns distance and travel time for?

We offer customers the option of calculating the distance between to Dutch addresses for things like travel expenses. One of the options we offer is the Google Distance Matrix where they enter two addresses and get a distance back for the expense item.

However, we are not sure which route it returns distance and travel time for. The documentation says it is the recommended route, but not on what that selection is based.

Our customers report that for the same set of origin and destination, the API returns different results over time. This leads them to suspect that current traffic conditions are part of the selection of the 'recommended' route. We'd like to be able to tell our customers what route is considered the best by the API. Is it the shortest, fastest, most used? Does anyone know?

We don't specify a departure time in the request, so the (link)

...choice of route and duration are based on road network and average time-independent traffic conditions. Results for a given request may vary over time due to changes in the road network, updated average traffic conditions, and the distributed nature of the service. Results may also vary between nearly-equivalent routes at any time or frequency.

I take from this that current traffic conditions are not taken into consideration. This is the same for the Google Directions API, so switching to that won't solve the issue.

The documentation does not offer more information on what is considered the recommended route, and why it varies when we don't include a departure time.

One customer suggested to use a departure time on a Sunday night in April 2030 for all requests, to avoid varying results. I kinda like the idea but it's a bit of a hack.

Upvotes: 0

Views: 31

Answers (1)

Kat
Kat

Reputation: 293

As stated in the documentation, you can use the Distance Matrix API to help determine the most efficient travel routes between multiple possible origins and destinations. This suggests that the recommended route provided by the API is its calculation of the most efficient path between the start and end points at the time of the request.

This typically takes into account factors such as travel time, distance, traffic conditions, and road types.

However, since you mentioned not specifying a departure time in your request, as noted in the documentation you linked, real-time traffic conditions are not considered. Instead, the route is determined using factors like the current road network and typical traffic patterns.

Below is a bulleted list of factors that influenced the choice of route and duration when departure time is not specified, as mentioned in the documentation. As a result, results for a given request, even for the same set of origin and destination, may vary over time:

  • Road network changes: New roads might be built, or existing roads might be closed or have altered speed limits.
  • Updated average traffic conditions: The API's data on typical traffic patterns is likely regularly updated, so the "recommended" route might change based on these updates.
  • Distributed nature of the service

For additional inquiries about the API, you can open a personalized communication channel with the Google Maps Platform team by creating a support case in the Google Cloud Console: https://developers.google.com/maps/support/#creating-a-support-case

Upvotes: 0

Related Questions