Skip to content Skip to sidebar Skip to footer

Google Directions Don't Work

I try to make directions for my current position and marker coordinate. so i get latitude and longitude using getcurrentposition. then, i mark it. function initialize() { directi

Solution 1:

If I call the calcRoute function (and pass in the "pos" and "node" locations, it can't find directions between where I am (in the US) and where the point is located (Raya Its, Sukolilo, Surabaya City, East Java 60117, Republic of Indonesia). The DirectionsService returns a status of "ZERO_RESULTS".

ZERO_RESULTS No route could be found between the origin and destination.

working example

functioncalcRoute(pos,node) {
var directionsService = new google.maps.DirectionsService();
  var request = {
      origin:pos,
      destination:node,
      travelMode: google.maps.DirectionsTravelMode.DRIVING
  };

  directionsService.route(request, function(response, status) {
    if (status == google.maps.DirectionsStatus.OK) {
      directionsDisplay.setDirections(response);
    } else { alert("Directions failed: "+status); }
  });
}

Post a Comment for "Google Directions Don't Work"