lldist: distance between lat-long coordinates

Description Usage Arguments Value Author(s)

View source: R/lldist.R

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

1
2
3
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 lat and long

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: max

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 max(maxlldist(y,x)). For examples, see OSMscale::maxEarthDist DEFAULT: TRUE

...

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, [email protected], Aug 2016 + Jan 2017. Angle formula from Diercke Weltatlas 1996, Page 245


brry/rdwd documentation built on Aug. 19, 2018, 7:24 p.m.