Internal function to calculate distances using the Haversine formula with WGS84 ellipsoid. Implements the algorithm described in Sinnott (1984) for computing great circle distances.
calculate_haversine_distance_wgs84(lon1, lat1, lon2, lat2, unit)
List with minimum distance and corresponding index.
Origin longitude.
Origin latitude.
Destination longitude vector.
Destination latitude vector.
Output unit: "nm" or "km".
The Haversine formula calculates the shortest distance between two points on a sphere given their latitude and longitude.
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