The shortest distance between two points (i.e., the 'great-circle-distance' or 'as the crow flies'), according to the 'haversine method'. This method assumes a spherical earth, ignoring ellipsoidal effects. Note that this version is implemented in C++. A quick benchmark to the version of geosphere showed it to be a non-insignificant speed enhancement. The algorithm converges in one-twentieth of the original time.
haversine(lat_from, lon_from, lat_to, lon_to, r = 6378137)
lat_from | Latitude of point. |
---|---|
lon_from | Longitude of point. |
lat_to | Latitude of point. |
lon_to | Longitude of point. |
r | Radius of the earth; default = 6378137m |
Vector of distances in the same unit as r
(default in meters).
The Haversine ('half-versed-sine') formula was published by R.W. Sinnott in 1984, although it has been known for much longer.
Sinnott, R.W, 1984. Virtues of the Haversine. Sky and Telescope 68(2): 159.
Martin Haringa
haversine(53.24007, 6.520386, 53.24054, 6.520386) #> [1] 52.32016