Learn R Programming

geosphere (version 1.5-20)

distGeo: Distance on an ellipsoid (the geodesic)

Description

Highly accurate estimate of the shortest distance between two points on an ellipsoid (default is WGS84 ellipsoid). The shortest path between two points on an ellipsoid is called the geodesic.

Usage

distGeo(p1, p2, a=6378137, f=1/298.257223563)

Value

Vector of distances in meters

Arguments

p1

longitude/latitude of point(s). Can be a vector of two numbers, a matrix of 2 columns (first column is longitude, second column is latitude) or a SpatialPoints* object

p2

as above; or missing, in which case the sequential distance between the points in p1 is computed

a

numeric. Major (equatorial) radius of the ellipsoid. The default value is for WGS84

f

numeric. Ellipsoid flattening. The default value is for WGS84

Author

This function calls GeographicLib code by C.F.F. Karney

Details

Parameters from the WGS84 ellipsoid are used by default. It is the best available global ellipsoid, but for some areas other ellipsoids could be preferable, or even necessary if you work with a printed map that refers to that ellipsoid. Here are parameters for some commonly used ellipsoids. Also see the refEllipsoids function.

ellipsoid a f
WGS84 6378137 1/298.257223563
GRS80 6378137 1/298.257222101
GRS67 6378160 1/298.25
Airy 1830 6377563.396 1/299.3249646
Bessel 1841 6377397.155 1/299.1528434
Clarke 1880 6378249.145 1/293.465
Clarke 1866 6378206.4 1/294.9786982
International 1924 6378388 1/297
Krasovsky 1940 6378245 1/298.2997381

more info: https://en.wikipedia.org/wiki/Reference_ellipsoid

References

C.F.F. Karney, 2013. Algorithms for geodesics, J. Geodesy 87: 43-55. tools:::Rd_expr_doi("10.1007/s00190-012-0578-z"). Addenda: https://geographiclib.sourceforge.io/geod-addenda.html. Also see https://geographiclib.sourceforge.io/

See Also

distCosine, distHaversine, distVincentySphere, distVincentyEllipsoid, distMeeus

Examples

Run this code
distGeo(c(0,0),c(90,90))

Run the code above in your browser using DataLab