Planning journeys ahead of time has always been difficult, since traffic conditions vary greatly over time. Developers have used live traffic data from the Google Maps APIs for years to help drivers with this problem, but up to now, this has been available only for journeys starting very close to now, and limited to Google Maps for Work customers only.



Today we’re extending traffic predictions in the Google Maps APIs indefinitely into the future - a feature we call predictive travel times. This will let developers plan journeys hours, days or even weeks in advance, using Google’s model of what the traffic conditions will be like on that day. We’re also making all traffic features in Directions API and Distance Matrix API available under our Standard Plan (2500 requests/day for free, with pay-as-you-go pricing for extra requests), and increasing the waypoint limit in Directions API for these developers from 8 to 23 waypoints. (Traffic features and higher waypoint limits in the JavaScript Maps API are available to Google Maps for Work customers for now.)



Using these new traffic features is super simple—just add the departure_time parameter to Directions API or Distance Matrix API queries, and the results will contain the travel time estimate given the predicted traffic conditions at that time. The route returned may also change depending on traffic conditions, which lets developers recommend the fastest route to their users. For example, the image below shows the fastest route from San Francisco International Airport to the Google campus in Mountain View late at night when there’s no traffic (blue), and during peak hour when an accident on Highway 101 has slowed traffic to a crawl (red).


Screen Shot 2015-11-10 at 8.26.11 PM.png



Since traffic conditions far in the future could vary greatly, developers can set an optional traffic_model parameter to choose whether they’d prefer to get an optimistic, pessimistic or best_guess estimate of the travel time. For example, one of our customers, Redfin, plan to use the Google Maps APIs to predict how long it will take to drive between homes, so they will use the pessimistic traffic model to ensure there’s enough travel time taking traffic into account. On the other hand, a developer building thermostat app wants their user’s house to be warm by the time they get home from work, so they would use the optimistic travel time estimate to calculate when their user is likely to get home, and when their thermostat needs to turn on.



The default traffic model, best_guess, returns the most likely travel time given everything that’s known about the traffic conditions—both the historical model for the queried time and day of the week, and the actual live traffic conditions right now. This can be used in apps that give drivers an indication of what their travel time will most likely be.



To learn more about the traffic features in the Google Maps APIs, please take a look at our video, check out the documentation for the Directions API, the Distance Matrix API and the JavaScript Maps API Directions and Distance Matrix services, or download the updated client libraries for Java or Python.



Posted by Elena Kelareva, Product Manager, Google Maps APIs