Learn R Programming

gmt (version 1.0-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

  • Vector of distances.

Details

Latitude and longitude are passed as decimal numbers, e.g. 66.5 for 66$^{\circ}$30$'$N. Vectors of coordinates are supported.

See Also

diff calculates the difference between two numbers. Trigonometric functions are summarized on the Trig help page.

Examples

Run this code
geodist(55.75,37.62, 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