Hello,
I am using the Google Maps API to draw map, find the distance between two
points, then display directions between the two points.
When using the API to get the distance, it is accurate. However, when I go
to display directions, it turns around and uses a different end address
(rather, the same street address, but in a different city). I have 6
different sites that a user can change between and only two of them use
different addresses. One of them always has and we have been battling it.
The other has always worked and suddenly it does not.
Has anyone else run into anything like this?
I figure the distance with this:
var request = {
origin:start,
destination:end,
travelMode: google.maps.DirectionsTravelMode.DRIVING,
unitSystem:google.maps.UnitSystem.IMPERIAL
};
directionsService.route(request, function(response, status) {
if (status == google.maps.DirectionsStatus.OK) {
dist = parseFloat(response.routes[0].legs[0].distance.value);
Which returns the correct distance between the two points. Then, after
some other processing, the address is again passed into a function that
does this:
var request = {
origin:start,
destination:address,
travelMode: google.maps.DirectionsTravelMode.DRIVING
};
directionsService.route(request, function(response, status) {
if (status == google.maps.DirectionsStatus.OK) {
directionsDisplay.setDirections(response);
}
});
And what is returned is not the same....
For instance, one address is 17 miles away from a point I use for testing.
I pass in the address and it returns the distance 17 miles but when I call
the second function and display the directions, it takes me to the same
street address in a different city that is 361 KM away....
I pass in XXXX W. 11 Mile Rd. Southfield MI for the address and the
directions take me to XXXX W. 11 Mile Rd. Manistee National Forest, Bitely,
MI 49309, USA.
Definitely not where I am trying to send people....
Any thoughts would be greatly appreciated...
Thank you.
Kevin
--
You received this message because you are subscribed to the Google Groups
"Google Maps JavaScript API v3" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-maps-js-api-v3/-/dWZXX50G0QsJ.
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.