Learn R Programming

gmt (version 1.2-0)

geodist: 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: "km" for kilometres, "nm" for nautical miles.

Value

Details

Latitude and longitude are passed as decimal numbers, e.g. 66.5 for 66$°$30$'$N. Vectors of coordinates are supported.

See Also

diff, Trig.

gmt-package gives an overview of the package.

Examples

Run this code
geodist(55.75,37.63, 39.9,116.4)  # Moscow - Beijing
geodist(90,0, -90,0, "nm")        # from pole to pole

Run the code above in your browser using DataLab