haversine: Compute great circle distance between two points

Description Usage Arguments Value Author(s) Examples

View source: R/haversine.R

Description

Computes the great circle distance between two points given their latitude and longitude (in decimal degrees) using the haversine formula. The output is the distance between the two points in the same units as the input 'r' (default is meters)

Usage

1
haversine(lon1, lat1, lon2, lat2, r = 6378137)

Arguments

lon1

longitude of first point

lat1

latitude of first point

lon2

longitude of second point

lat2

latitude of second point

r

radius of earth (default is in meters)

Value

Outputs a scalar giving the great circle distance in the same units as the input radius.

Author(s)

Michael Malick

Examples

1
 haversine(-147, 48, -154, 49)

MichaelMalick/r-malick documentation built on May 7, 2019, 4:56 p.m.