weather_report v0.1.0 WeatherReport.Distance

Distance related functions.

Summary

Functions

Calculates the distance (in meters) between two lat long coordinates by using the haversine forumla

Types

coordinate :: {float, float}

Functions

calc(arg1, arg2)

Specs

calc(coordinate, coordinate) :: float

Calculates the distance (in meters) between two lat long coordinates by using the haversine forumla:

a = sin²(Δφ/2) + cos φ1 * cos φ2 * sin²(Δλ/2)
c = 2 * atan2( √a, √(1−a) )
d = R * c

where φ is latitude, λ is longitude, R is earth’s radius (mean radius = 6,371km)