Hi everybody! I need to know the distance between two points. I have
the LatLng object which their information. I have used the
DirectionsService class and route method and I have something like
this:

var request = {
    origin:myLatLng1,
    destination:myLatLng2,
    travelMode: google.maps.DirectionsTravelMode.DRIVING
  };
  directionsService.route(request, function(result, status) {
    if (status == google.maps.DirectionsStatus.OK) {
      myArray[i] = result.routes[0].legs[0].distance.value  // var i
is not important in this context
    }
  });

So, when I show myArray[i] the distance is incorrect. Anybody knows
where is the problem?
Thanks a lot.

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Reply via email to