[GIS] Unit of Google Maps API geometry services

google mapsgoogle-maps-api

When i call the method

google.maps.geometry.spherical.computeDistanceBetween(from, to);

it returns a number,

is this distance in KiloMeters or Miles??

How can we find this and doc on this API?

Best Answer

The function signature is:

computeDistanceBetween(from:LatLng, to:LatLng, radius?:number)

Given the documentation for the computeArea() function just above, I think you can safely assume it is in the same units as the radius, where "the default radius is Earth's radius of 6378137 meters".

Of course, the earth isn't as spherical as Google Maps might like it to be, so be careful about how you apply that distance...