Calculates the shortest distance between two points on the
Earth's surface using the Haversine formula, also known as the great-circle
distance or "as the crow flies".
Usage
haversine(lat_from, lon_from, lat_to, lon_to, r = 6378137)
Arguments
- lat_from
Latitude of the starting point.
- lon_from
Longitude of the starting point.
- lat_to
Latitude of the destination point.
- lon_to
Longitude of the destination point.
- r
Radius of the Earth in meters (default = 6378137).
Value
Vector of distances in the same unit as r
(default in meters).
Details
The Haversine ('half-versed-sine') formula was published by R.W.
Sinnott in 1984, although it has been known for much longer.
References
Sinnott, R.W, 1984. Virtues of the Haversine. Sky and Telescope
68(2): 159.
Examples
haversine(53.24007, 6.520386, 53.24054, 6.520386)
#> [1] 52.32016