Learn R Programming

Tivy (version 0.1.1)

calculate_haversine_distance_wgs84: Calculate distance using Haversine formula

Description

Internal function to calculate distances using the Haversine formula with WGS84 ellipsoid. Implements the algorithm described in Sinnott (1984) for computing great circle distances.

Usage

calculate_haversine_distance_wgs84(lon1, lat1, lon2, lat2, unit)

Value

List with minimum distance and corresponding index.

Arguments

lon1

Origin longitude.

lat1

Origin latitude.

lon2

Destination longitude vector.

lat2

Destination latitude vector.

unit

Output unit: "nm" or "km".

Details

The Haversine formula calculates the shortest distance between two points on a sphere given their latitude and longitude.

References

Sinnott, R.W. (1984). Virtues of the Haversine. Sky and Telescope, 68(2), 159.

Veness, C. (2002-2022). Calculate distance, bearing and more between Latitude/Longitude points. Movable Type Scripts. https://www.movable-type.co.uk/scripts/latlong.html