Using the Haversine formula to calculate the great-circle distance between 2 points.
go get -u github.com/ehis/distancedistance.GreatCircle()- returns the great-circle distance between 2 points.
// []float64{longitude, latitude}
pt1 := []float64{-180, 40.71427}
pt2 := []float64{180, 40.71427}
d := distance.GreatCircle(pt1, pt2) distance.PointSegment()- return the distance between a point and the closest point on a line segment.
// []float64{x, y}
pt := []float64{3, 2}
pt1 := []float64{-2, 1}
pt2 := []float64{5, 3}
d := distance.PointSegment(pt, pt1, pt2)Inspiration from distance - an elixir library