i still do it this way: google.maps.LatLng.prototype.distanceFrom = function(newLatLng) { var R = 6371000; 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; }
On 17 Mrz., 03:06, Jian He <hejian...@gmail.com> wrote: > Hi Gurus, > > I am new to developing the local community database which stored many > points, I know I could simple input 2 point and get the actual drive > distance, however, if there is a way I could retrive those distance > value and store them in the database(access), it will be good. > > I have researched the Haversine formula, even it is suit for geography > caculation but it seems not suit for the drive distance. > > Thanks for your kindly help, -- 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-v3@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.