haversine: Haversine distance between two points on the Earth's surface

Description Usage Arguments Value Examples

View source: R/kernel.R

Description

Haversine distance between two points on the Earth's surface

Usage

1
haversine(s_i, s_j)

Arguments

s_i

Point i, identified by latitude and longitude

s_j

Point j

Value

Distance between points i and j, in km

Examples

1
2
3
4
d1 = haversine(s_i = list(lat = 0, lon = 10), s_j = list(lat = 0, lon = 11))
d2 = haversine(s_i = list(lat = 10, lon = 10), s_j = list(lat = 11, lon = 10))
abs(2 * pi * 6371 / 360 - d1) < 0.001
abs(2 * pi * 6371 / 360 - d2) < 0.001

rtlemos/scallops documentation built on May 4, 2019, 7:43 p.m.