geodist {gmt} | R Documentation |
Distance Between Geographic Coordinates
Description
Calculate surface distance between geographic coordinates.
Usage
geodist(Nfrom, Efrom, Nto, Eto, units="km")
Arguments
Nfrom |
latitude of origin. |
Efrom |
longitude of origin. |
Nto |
latitude of destination. |
Eto |
longitude of destination. |
units |
how distance is measured: |
Details
Latitude and longitude are passed as decimal numbers, e.g. 66.5 for
6630
N. Vectors of coordinates are supported.
Value
Vector of distances.
Note
The surface distance between geographic coordinates is:
where distance and coordinates are expressed in radians.
and
is the latitude of origin
and destination, and
and
is
longitude.
The calculations assume a perfect sphere and elevation differences are ignored. The SI definition of a nautical mile is exactly 1.852 km.
See Also
gmt-package
gives an overview of the package.
Examples
geodist(55.75,37.63, 39.9,116.4) # Moscow - Beijing
geodist(90,0, -90,0, "nm") # from pole to pole
[Package gmt version 2.0.3 Index]