WeatherReport.Distance (weather_report v0.3.0)

Distance related functions.

Link to this section Summary

Functions

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

Link to this section Types

Link to this type

coordinate()

@type coordinate() :: {float(), float()}

Link to this section Functions

Link to this function

calc(arg1, arg2)

@spec 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, (1a) )
d = R * c

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