lldist {rdwd} | R Documentation |
distance between lat-long coordinates
Description
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.
Usage
lldist(lat, long, data, r = 6371, i = 1L)
maxlldist(lat, long, data, r = 6371, fun = max, each = TRUE, ...)
Arguments
lat , long |
Latitude (North/South) and longitude (East/West) coordinates in decimal degrees |
data |
Optional: data.frame with the columns |
r |
radius of the earth. Could be given in miles. DEFAULT: 6371 (km) |
i |
Integer: Index element against which all coordinate pairs are computed. DEFAULT: 1 |
fun |
Function to be applied. DEFAULT: |
each |
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 |
... |
Further arguments passed to fun, like na.rm=TRUE |
Value
Vector with distance(s) in km (or units of r
, if r
is changed)
Author(s)
Berry Boessenkool, berry-b@gmx.de, Aug 2016 + Jan 2017. Angle formula from Diercke Weltatlas 1996, Page 245