haversine: haversine

Description Usage Arguments Value Note Author(s) References See Also Examples

View source: R/haversine.R

Description

This is the haversine formula for determining distance between coordinated on a globe.

Usage

1
haversine(xLat, xLon, yLat, yLon)

Arguments

xLat

Position 1 latitude.

xLon

Position 1 longitude.

yLat

Position 2 latitude.

yLon

Position 2 longitude.

Value

The output is a list with the coordinates, distance in kilometers and miles.

xLat

Position 1 latitude.

xLon

Position 1 longitude.

yLat

Position 2 latitude.

yLon

Position 2 longitude.

distKm

Distance between points in kilometers.

distMi

Distance between points in miles.

Note

There is some variation between computations due to the measurement used for the Earth's radius. This implementation uses the mean radius measurement of 6371 km versus the equitorial radius of 6378. Feel free to adjust if your opinion differs!

Author(s)

Randall Shane, PhD
rshane@basexvi.com

References

http://en.wikipedia.org/wiki/Haversine_formula
http://www.movable-type.co.uk/scripts/latlong.html
http://www.platoscave.net/blog/2009/oct/5/calculate-distance-latitude-longitude-python/

See Also

degrees2radians, geoAddress, geoIP

Examples

1
haversine("28.54703","-81.30292","26.93422","-80.09421")

RandallShanePhD/geoPlot documentation built on May 18, 2019, 1:34 p.m.