diff --git a/src/components/MapView/utils.ts b/src/components/MapView/utils.ts index 8db8e6647d56..04176d715281 100644 --- a/src/components/MapView/utils.ts +++ b/src/components/MapView/utils.ts @@ -22,6 +22,7 @@ function haversineDistance(coordinate1: number[], coordinate2: number[]) { const lat2 = (coordinate2[0] * Math.PI) / 180; const deltaLat = ((coordinate2[0] - coordinate1[0]) * Math.PI) / 180; const deltaLon = ((coordinate2[1] - coordinate1[1]) * Math.PI) / 180; + // The square of half the chord length between the points const halfChordLengthSq = Math.sin(deltaLat / 2) * Math.sin(deltaLat / 2) + Math.cos(lat1) * Math.cos(lat2) * Math.sin(deltaLon / 2) * Math.sin(deltaLon / 2);