Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/ypankaj007/haversine-formula

Haversine formula to find distance between two points on a sphere
https://github.com/ypankaj007/haversine-formula

distance go haversine-formula sphere

Last synced: 2 days ago
JSON representation

Haversine formula to find distance between two points on a sphere

Awesome Lists containing this project

README

        

# Haversine Formula

Haversine formula calculates the distance between two points by using latitude and logitude on a sphere. There are lot of applications using navigation system and haversine formula are playing big role to calcutate the shortest distance between locations.
# Formula

Suppose we have two ponits p1 and p2. let radius of p1 is (φ1, λ1) and p2 is (φ2, λ2).
So difference between p1 and p2, by using haversine formula, is
```
a = sin²(Δφ/2) + cos φ1 ⋅ cos φ2 ⋅ sin²(Δλ/2)
c = 2 ⋅ atan2( √a, √(1−a) )
d = R ⋅ c
```
where Δφ = φ2 - φ1, Δλ = λ2 - λ1 and R is the Earth radius (63,71,000 m)

License
----

MIT

**Free Software, Hell Yeah!**