haversineképlet
The haversine formula is a mathematical formula used to calculate the great-circle distance between two points on a sphere given their longitudes and latitudes. This formula is particularly useful in navigation and cartography because it accounts for the curvature of the Earth, treating it as a perfect sphere for simplicity. The "haversine" itself refers to the haversine function, which is defined as hav(θ) = sin²(θ/2).
To apply the haversine formula, you need the latitude and longitude of the two points, typically denoted
a = sin²(Δφ/2) + cos φ1 ⋅ cos φ2 ⋅ sin²(Δλ/2)
Here, Δφ is the difference in latitude (φ2 − φ1), and Δλ is the difference in longitude (λ2 − λ1).