I found that sometimes google directions service returns zero results with transit transort mode. At the same time https://maps.google.com/ can finds rout for the same adresses.
Pls try:
http://maps.googleapis.com/maps/api/directions/xml?origin=Uzhhorod&destination=Zhytomyr&sensor=false&departure_time=1351544080&mode=transit
Returns ZERO_RESULTS, however Google Maps itself returns many results.
http://maps.google.com (->directions)
Origin: Uzhhorod
Destination: Zhytomyr
Departure at: 10/29/12 20:38 (1351544080 - Unix Time stamp)
What is going on?
It seems that there is undocumented time window(time limits) for departure date. For example, google direction service can search only routes with in 8 hours after departure_time(we need to clear up this window from google developers team) . So solution will be to add 8 hours to departure_time and try for results, and make loop during suitable time. I tested, that works. I think that is the secret of maps.google.com
Related
The Google Maps API docs as well as all questions I have found on Stack Overflow all state that departure time must be included to return traffic duration. However, my application requires the use of arrival time and not departure time.
The docs state that one can pass either departure or arrival time, but this is not mentioned in relation to duration_in_traffic. Is it possible to pass arrival time instead of departure time and still receive the duration_in_traffic? Maps itself does this, I don't see a reason for Google's API to be any different.
This is not currently possible, but there is a long-standing feature request to have this feature added. You can star the issue to receive updates and show Google that there is additional interest.
Ireland are using a post code system called "Eircode" which is valid layer in google maps and searching an Eircode e.g D03E5Y8 will result in the correct address on the Google map - much like UK / US zips.
https://www.google.ie/maps/place/Drumcondra,+Dublin,+D03+E5Y8/#53.3608019,-6.2560623,17z/data=!3m1!4b1!4m5!3m4!1s0x48670e639f49ad8d:0xfe32bee99c51f2ee!8m2!3d53.3607987!4d-6.2538683?hl=en
I was using an api call like below with a valid Eircode in the origins value. The lookup was working perfectly up to 1-2 days ago (Feb 19th /20th, 2018) - however it now returns a null value (please replace the key with your own API key)
https://maps.googleapis.com/maps/api/distancematrix/json?origins=D03+E5Y8&destinations=dublin&language=en-EN&key=xxxxxxxxxxxxxxxxxxxxxxxxxx&sensor=false
Previously the distance matrix worked with Google maps and you could enter 2 eircodes into origins= and destinations=
To illustrate further entering a valid UK post code into the origins value
https://maps.googleapis.com/maps/api/distancematrix/json?origins=ll652ez&destinations=dublin&language=en-EN&key=xxxxxxxxxxxxxxxxxxx&sensor=false
results in a correct call.
Have Eircode or Google maps now disabled this functionality for Eircode lookups? This would seem like a major step backwards!
Appreciate any help on this before I go back to the drawing board!
SOLUTION
Add +ire to the Eircode value origins=T12KC86+ire&destinations=V92YP93+ire
I want to find a travel time (including traffic) between two addresses.
Inputs - origin, destination, arrival time, mode of transportation, traffic model (pessimistic, optimistic, best guess)
Output - Travel time
It looks like the Google Distance Matrix API is the API I should be using for this except that I am not able to add an input of arrival time for driving. I am prompted to add a departure time. When the transportation mode is transit I am able to enter an arrival time.
Is this a limitation of the distance matrix API? Is there a paid for version or another work around for this?
As of today (January 6, 2019) arrival time for driving is not supported. Here is the relevant portion of the help file for the API's directions method:
:param arrival_time: Specifies the desired time of arrival for transit
directions. Note: you can't specify both departure_time and
arrival_time.
:type arrival_time: int or datetime.datetime
The key being that arrival time is only used for transit directions and not driving directions. When I use mode='driving' and an arrival_time, I get and error that ends with:
raise googlemaps.exceptions.HTTPError(response.status_code)
googlemaps.exceptions.HTTPError: HTTP Error: 400
When I change this to a departure_time, the function call works just fine.
Explicit answers to the questions:
Is this a limitation of the distance matrix API?
Yes.
Is there a paid for version or another work around for this?
No. Your only option is call the API with a guess for the departure time, find the travel time and then iterate until the arrival time converges.
instead of using the google direction matrix try to use google map direction API, it will give you best results with the time distance and traffic update, see GOOGLE MAP DIRECTIONS API docs.
You need to use the Google map distance matrix API, which get input as source latitude, longitude and destination latitude, longitude. It will return the json file contains the source address, destination address, distance in km and time with traffic and without traffic.Below is link follow it
https://developers.google.com/maps/documentation/distance-matrix/intro
There is also a limit of this API, it allows only 2500 hits per day
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:
https://maps.googleapis.com/maps/api/directions/json?origin=Bielefeld&destination=Dortmund&arrival_time=1460836800&key=AIzaxxxxxxxxxxxxxxxxxxxxxxxxxxx
best regards
Michael
I have a little problem about Google Maps. I'm using Geocoding (xml) for getting address from Google Map. I give the address and Geocoding gives me long-latt values.
And when I try to bind many location Google map just shows 11 location, not more.
And it gives an warning like
"Over query limit"
How can I solve this problem?
Google limits the number of geocoding requests per second. You can either wait or cache the results somewhere in your own database.
See this related question.