| gcdist | R Documentation |
Calculate the minimum great circle distance between points on a sphere
gcdist(x, y, rad = 1) gcdistPaired(x, y, rad = 1)
x,y |
The locations of the two points for which the distance is to be
calculated. Each must be a matrix with 2 columns (with location in
spherical coordinates) or or 3 (location in Cartesian coordinates),
or objects of class |
rad |
Optional. The radius of the sphere, default is 1. |
For any two points on a sphere, the shortest path (also on the sphere) is the minor arc of a great circle (that is, a circle that is concentric with the sphere, and is a subset of the sphere).
The function gcdist calculates the great circle distance
between each pair of points in x and y, returning a
matrix of size m * n where m is the number of
points in x and n is the number of points in y.
The function gcdistPaired calculates the great circle distance
between corresponding points in x and y (that is,
between the ith point in x and the ith point in
y for each index i), returning a
numeric vector. The point patterns x and y should
contain equal numbers of points.
A numeric matrix or vector giving the minimum great circle distance between the given pairs of points.
Tom Lawrence <email:tjlawrence@bigpond.com>
nndistsph (nearest neighbour distances),
pairdistsph (pairwise distances),
bdist.sphwin (boundary distances)
dist (methods for measuring distance in R^d)
x1 <- matrix(c(pi/2, 0), ncol=2) y1 <- matrix(c(pi/2, pi/4), ncol=2) gcdist(x=x1, y=y1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.