dist_wlatlng {skm}R Documentation

dist_wlatlng

Description

calculate distance btwn coordinate1<lat1, lng1> and coordinate2<lat2, lng2>

Usage

dist_wlatlng(.lat1, .lng1, .lat2, .lng2, .measure = "mi")

Arguments

.lat1

latitude of coordinate1

.lng1

longitude of coordinate1

.lat2

latitude of coordinate2

.lng2

longitude of coordinate2

.measure

- mi or km

Details

calculate the great circle distance between 2 points with Haversine formula, which deliberately ignores elevation differences.

Haversine formula (from R.W. Sinnott, "Virtues of the Haversine", Sky and Telescope, vol. 68, no. 2, 1984, p. 159):

dlon = lon2 - lon1

dlat = lat2 - lat1

a = sin^2(dlat/2) + cos(lat1) * cos(lat2) * sin^2(dlon/2)

c = 2 * arcsin(min(1,sqrt(a)))

d = R * c


[Package skm version 0.1.5.4 Index]