I use the Google Directions API for calculating the needed time between 2 places. The API gives me an option departure_time
, where I can pass the timestamp of the departure time (or "now"). Then the answer is the duration_in_traffic
. This is working really great.
But I need to show the amount of time that the user needs with his car, when he want to be at his target at a specific time.
E.g. the user wants to be in Dortmund at 8pm (20:00). So I need to show him when he should start driving to arrive in time at his desired goal. The API-documentation says, that there is a parameter arrival_time
, which does exactly what I need. Unfortunately they say it does only work for public-transport.
But Google maps itself offers the desired functionallity even for cars! As you can see in the screenshot: I said that I want to be in dortmund at 20:00 and google-maps says, I should start driving 'arround 18:30'
So how I can I achieve this with my app? Do I need another API or do I need to pass other parameters?
Here is my current API call:
best regards Michael
arrivalTime
to be set. – Firepowerarrival_time
available on "driving" mode in Directions API to get theduration_in_traffic
. You can view and star it here to keep yourself updated if there are any changes in the API. – Carrasquillo