Skip to contents

Smallest angle between two points on the surface of a sphere, measured along the surface of the sphere

Usage

orthodrome(lat1, lon1, lat2, lon2)

haversine(lat1, lon1, lat2, lon2)

vincenty(lat1, lon1, lat2, lon2)

Arguments

lat1, lat2

numeric vector. latitudes of point 1 and 2 (in radians)

lon1, lon2

numeric vector. longitudes of point 1 and 2 (in radians)

Value

numeric. angle in radians

Details

"orthodrome"

based on the spherical law of cosines

"haversine"

uses haversine formula that is optimized for 64-bit floating-point numbers

"vincenty"

uses Vincenty formula for an ellipsoid with equal major and minor axes

References

Examples

berlin <- c(52.52, 13.41)
calgary <- c(51.04, -114.072)
orthodrome(berlin[1], berlin[2], calgary[1], calgary[2])
#> [1] 0.8595483
haversine(berlin[1], berlin[2], calgary[1], calgary[2])
#> [1] 0.8595483
vincenty(berlin[1], berlin[2], calgary[1], calgary[2])
#> [1] 0.8595483