On Feb 8, 1:58 pm, vikram <[email protected]> wrote:
>
> As per Google API i had tried the following code snippet.
>
> //Get the Distance between two address.
>  gdir = new GDirections();
>  gdir.load("from: " + compaddress + " to: " + useraddress, "en_US");
>  var lstrDistance = gdir.getDistance();
>  alert(lstrDistance);

See the documentation.
GDirections.load() takes a directions string and an **object** for the
options:
  gdir.load("from: " + compaddress + " to: " + useraddress,
{locale:"en_US"});
GDirections.getDistance() returns an **object** and you need to
interrogate that:
  var lstrDistance = gdir.getDistance().meters;

> Kindly let me know how to get the distance between two places in
> miles.

Then divide the number of metres by the number of metres in a mile
(1609):
  lstrDistance = lstrDistance / 1609;
and round as required.

Andrew
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Maps API" 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-API?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to