# geod: Geodesic Distances In pegas: Population and Evolutionary Genetics Analysis System

 geod R Documentation

## Geodesic Distances

### Description

This function calculates geodesic (or great-circle) distances between pairs of points with their longitudes and latitudes given in (decimal) degrees.

### Usage

```geod(lon, lat = NULL, R = 6371)
```

### Arguments

 `lon` either a vector of numeric values with the longitudes in degrees, or, if `lat = NULL`, a matrix giving the longitudes (first column) and the latitudes (second column). `lat` a vector with the latitudes. `R` the mean radius of the Earth (see details).

### Details

The default value of `R` is the mean radius of the Earth which is slightly smaller than the radius at the equator (6378.1 km).

### Value

a numeric symmetric matrix with the distances between pairs of points in kilometres.

### References

`geoTrans`, `as.dist`

### Examples

```## the distance between 0N 0E and 0N 180E...
geod(c(0, 180), c(0, 0)) # ~ 20015.09 km
## ... the same using the radius of the Earth at the equator:
geod(c(0, 180), c(0, 0), 6378.1) # ~ 20037.39 km
## The same comparison for two points 5 degrees apart:
geod(c(0, 5), c(0, 0)) # ~ 555.9746 km
geod(c(0, 5), c(0, 0), 6378.1) # ~ 556.5942 km
```

pegas documentation built on March 7, 2023, 7:21 p.m.