distAB {clim.pact} | R Documentation |
The function returns the distance between two points on Earth given by the lon-lat coordinates. The distance is computed using the formula: d = a * theta, and |x1|*|x2| * cos(theta) = inner-product(x1,x2).
distAB(lon,lat,lons,lats,a=6.378e06)
lon |
Longitude of reference point (degrees East). |
lat |
Latitude of reference point (degrees North). |
lons |
Longitude of points of interest (vector) (degrees East). |
lats |
Latitude of points of interest (vector) (degrees North). |
a |
Radius of the Earth. |
A real value: units=meters.
R.E. Benestad
distAB(10,60,5,58) # [1] 362802.3 distAB(0,0,180,0) # [1] 20037078 distAB(0,90,0,-90) # [1] 20037078