Learn R Programming

mobr (version 2.0.2)

sphere_dist: Internal function for distance matrix assuming inputs are longitude and latitudes on a spherical Earth.

Description

This calculation uses the Haversine method of computing great circle distances in kilometers on a spherical Earth (r = 6378.137 km). This code was taken from fields::rdist.earth by Doug Nychka, John Paige, Florian Gerber.

Usage

sphere_dist(coords, r = 6378.137)

Value

distance matrix between all pairwise coordinates.

Arguments

coords

a matrix with longitudes and latitudes in decimal degrees. The longitudes should be provided in the first column (they are the x-coordinate) and the latitudes should be provided in the second column (they are the y-coordinate).

r

the radius of the Earth, defaults to 6378.137 km