In the google maps user-facing client, you can get ranges on a route's time (e.g. a planned route from London to Edinburgh shows "typically 6 hr 50 min to 8 hr 50 min, Arrive at about 10:30 PM"). How can you pull that prediction info out of the Google Maps Platform APIs? I'm guessing either the DistanceMatrix or the new Routes APIs would be the ones, but neither look like they expose this, just giving a single value for the predicted journey time.
Asked
Active
Viewed 92 times
1
-
2What language are you planning to use? As of now, there's no documented way to pull that prediction. But maybe you can try utilizing the `pessimistic` and `optimistic` of the `traffic_model` parameter by fetching both and just concatenate them together with a string like "typically x hours y minutes to x hours y minutes.". But this also seems like a neat idea and worth a feature request on the issue tracker. Try filing it here: [Issue Tracker](https://issuetracker.google.com/issues/new?component=188841&template=789306) – Yrll Dec 07 '22 at 23:37
-
Thanks @Yrll. Using Python, though just via the web API so it should be language agnostic. Interestingly, it looks like `pessimistic` and `optimistic` are only options on the DistanceMatrix API, not on the newer Routes API :( – Spycho Dec 12 '22 at 11:42
-
2Feature request submitted: https://issuetracker.google.com/issues/262140646 – Spycho Dec 12 '22 at 11:55
-
2https://developers.google.com/maps/documentation/routes/reference/rest/v2/RoutingPreference - but the feature request makes sense. – MrUpsidown Dec 14 '22 at 21:27