haversinMeters

fun haversinMeters(lat1: Double, lon1: Double, lat2: Double, lon2: Double): Double

Returns the Haversine distance in meters between two points specified in decimal degrees (latitude/longitude). This works correctly even if the dateline is between the two points.

Error is at most 4E-1 (40cm) from the actual haversine distance, but is typically much smaller for reasonable distances: around 1E-5 (0.01mm) for distances less than 1000km.

Return

distance in meters.

Parameters

lat1

Latitude of the first point.

lon1

Longitude of the first point.

lat2

Latitude of the second point.

lon2

Longitude of the second point.


Returns the Haversine distance in meters between two points given the previous result from .haversinSortKey

Return

distance in meters.