Great-circle distance between points at lat-long coordinates. Mostly a copy of OSMscale::earthDist Version 0.5.3 (2017-04-19). https://github.com/brry/OSMscale/blob/master/R/earthDist.R#L57-L102. Copied manually to avoid dependency hell. Does not check coordinates. Not exported.
lldist(lat, long, data, r = 6371, i = 1L)maxlldist(lat, long, data, r = 6371, fun = max, each = TRUE, ...)
Vector with distance(s) in km (or units of r
, if r
is changed)
Latitude (North/South) and longitude (East/West) coordinates in decimal degrees
Optional: data.frame with the columns lat
and long
radius of the earth. Could be given in miles. DEFAULT: 6371 (km)
Integer: Index element against which all coordinate pairs are computed. DEFAULT: 1
Function to be applied. DEFAULT: max()
Logical: give max dist to all other points for each point separately?
If FALSE, will return the maximum of the complete distance matrix,
as if max(maxlldist(y,x))
. For examples, see
OSMscale::maxEarthDist
DEFAULT: TRUE
Further arguments passed to fun, like na.rm=TRUE
Berry Boessenkool, berry-b@gmx.de, Aug 2016 + Jan 2017. Angle formula from Diercke Weltatlas 1996, Page 245