Here is the URL i am using :
https://maps.googleapis.com/maps/api/directions/json?origin=28.6139,77.2090&destination=25.992003,-80.117802&key=API KEY
When i am hitting this URL in browser , i am getting following response :
{
"geocoded_waypoints" : [ {}, {} ],
"routes" : [],
"status" : "ZERO_RESULTS"
}
Source location is delhi and destination location is 3555 N Ocean Dr, Hollywood, FL 33019, USA . If i change the destination location to any other then i am getting values for geocoded waypoints but why not for above values?
Help is deeply appreciated.
I think your error is caused by travel modes restriction in Direction API.
When you calculate directions, you may specify the transportation
mode
to use. By default, directions are calculated asdriving
directions. The following travel modes are supported:
driving
(default) indicates standard driving directions using the road network.walking
requests walking directions via pedestrian paths & sidewalks (where available).bicycling
requests bicycling directions via bicycle paths & preferred streets (where available).transit
requests directions via public transit routes (where available). If you set the mode totransit
, you can optionally specify either adeparture_time
or anarrival_time
. If neither time is specified, thedeparture_time
defaults to now (that is, the departure time defaults to the current time). You can also optionally include atransit_mode
and/or atransit_routing_preference
.
Sample Route in Google Maps App(Browser)
https://www.google.com.ph/maps/dir/28.6139,77.209/'25.992003,-80.117802'/@22.2476068,-39.0397189,4z/data=!3m1!4b1!4m6!4m5!1m0!1m3!2m2!1d-80.117802!2d25.992003
If you will check that link in your browser, the travel mode is flight which is not available in the Direction API.
Here is a previous question : How to set travel mode to “Flight” in google map direction API
Hope this helps.