Distance Method "GLatLng.distanceFrom" Earth Radius | cob_geo | 8/24/06 2:05 PM | Hi guys, I'm trying to understand the algorithm for calculating distances What does the algorithm look like? thanks, |

Re: Distance Method "GLatLng.distanceFrom" Earth Radius | Marcelo | 8/24/06 11:26 PM | Manuel, The radius used seems to be 6378137 meters. The function is this: B.prototype.Me=function(a){ It is obfuscated, so it might take me a couple of hours to read it distanceFrom(a){ var f = 2 * Math.asin( Math.sqrt( Math.pow( Math.sin(d/2) , 2 ) + Another function I have for the distance is this: function getDistance(lat1, lon1, lat2, lon2, unit) {
------------------------------------------------ |

Distance Method "GLatLng.distanceFrom" Earth Radius | cob_geo | 8/24/06 2:22 PM | |

Re: Distance Method "GLatLng.distanceFrom" Earth Radius | cob_geo | 8/25/06 12:53 PM | I experimented a bit around with different formulas, but in the end, the formula I mentioned in my first post brought the same results as the "GLatLng.distanceFrom" method, using your radius of 6378137 m. I had to convert the degrees to radians first, but now it's spot on :) |