distAB {clim.pact} | R Documentation

## Distance between two points on Earth

### Description

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).

### Usage

    distAB(lon,lat,lons,lats,a=6.378e06)

### Arguments

`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.

### Value

A real value: units=meters.

### Author(s)

R.E. Benestad

### Examples

    distAB(10,60,5,58)    # [1] 362802.3
    distAB(0,0,180,0)     # [1] 20037078
    distAB(0,90,0,-90)    # [1] 20037078

[Package Contents]