Route Service Doesn't Work In Google Map When I Change Google.maps.latlng
I am trying to develop a application using google map . Description of application : The user show see the google map on the screen and should be able to click on the map and see t
Solution 1:
if you look at these link: https://developers.google.com/maps/documentation/javascript/directions section "Travel Modes"
"If you request directions for a region in which that direction type is not available, the response will return the DirectionsStatus="ZERO_RESULTS"."
in your case it returns "ZERO_RESULTS":
directionsService.route(request, function(response, status) {
console.log(response);
alert(status);
if (status == google.maps.DirectionsStatus.OK) {
directionsDisplay.setDirections(response);
}
});
Solution 2:
It looks like the location is too far away from any roads, so the directions service does not know where to start the route from. If you move the position closer to a road, for example like so: var myLatlng = new google.maps.LatLng(35.49000000000, 51.36565089010);
then you'll see that it works.
Post a Comment for "Route Service Doesn't Work In Google Map When I Change Google.maps.latlng"