as far as i saw is no distancesFrom function in V3 atm (or is there
now?)

might try this here:

google.maps.LatLng.prototype.distanceFrom = function(newLatLng)
  {
   var R = 6371000; // m
    var lat1 = this.lat();
    var lon1 = this.lng();
    var lat2 = newLatLng.lat();
    var lon2 = newLatLng.lng();
    var dLat = (lat2-lat1) * Math.PI / 180;
    var dLon = (lon2-lon1) * Math.PI / 180;
    var a = Math.sin(dLat/2) * Math.sin(dLat/2) +
      Math.cos(lat1 * Math.PI / 180 ) * Math.cos(lat2 * Math.PI /
180 )
      *
      Math.sin(dLon/2) * Math.sin(dLon/2);
    var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));
    var d = R * c;
    return d;
  }

regards

On 31 Mai, 10:28, Peter <codehunte...@gmail.com> wrote:
> I was currently updating my system from api v2 to api v3.  When doing
> so I noticed that the two systems gave two different distances from
> two points.  The two points were as followed:
>
> (50.749,-2.453) to (52.461783,-1.154466) which are two uk post codes.
> The api v2 gave a distance of 179 miles, which is the same as the
> google maps website if you type them in, in the directions panel. e.g.
>
> http://maps.google.com/maps?saddr=50.749,-2.453&daddr=52.461783,-1.15...
>
> Where as on google maps api v3 the distance was 177 miles.  Can anyone
> tell me why the results vary becasue it occurs on others aswell.  My
> google maps setup is just the standard code no fancy business.
>
> Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Google Maps JavaScript API v3" group.
To post to this group, send email to google-maps-js-api...@googlegroups.com.
To unsubscribe from this group, send email to 
google-maps-js-api-v3+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-maps-js-api-v3?hl=en.

Reply via email to