If you just want to get the distance as a number, try something like this.
function InitDistances() {
var startLocation = new GLatLng(startLat, startLon);
var endLocation = new GLatLng(endLat, endLon);
var dist = startLocation .distanceFrom(endLocation);
return (dist / 1609.344).toFixed(2);
}
Brian
source
share