开发者

Using Google Maps API to Estimate Future Trip Duration

Is it possible to ask Google Maps for an estimated travel time between two points at an arbitrary time in the future?

开发者_Go百科

I routinely use the Google Maps Navigation app on my Droid phone while driving, and it's amazingly useful, especially since it's aware of traffic delays. However, I'd like to get these notifications of traffic delays ahead of schedule, so I know to leave early if the fastest route will take a little longer than usual. Essentially, I'd like to make a version of those radio traffic alerts, except one that's actually useful in that it knows the exact points I'm travelling to and from.

I've searched the docs, and while there's been some similar questions and info on adding traffic overlays to a map, or getting directions, and even getting trip duration, there doesn't seem to be any explicit way to specify when the trip takes place (e.g. when I usually commute).

EDIT: I'm not expecting to get a prediction for a month in the future. Just a couple hours at most.


Doesn't look like it.

The Google Maps API Direction class has a getDuration() method, which the number seconds of the trip duration.

The GDirectionsOptions class doesn't include any temporal methods. It has things like specifying trip type (drive, walk, bus), 'avoid highways' flags, etc.

Even if there were some way to extrapolate the traffic to a future time, there is no method to access the data itself, so you couldn't use it to calculate your own duration anyway.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜