Skip to content
Haversine distance between two points
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
LICENSE
README.md
haversine.go
haversine_test.go

README.md

haversine

This module uses the commonly used haversine formula for calculating small distances between two points.

Example

package main

import (
	"fmt"
	"pault.ag/go/haversine"
)

func main() {
	whiteHouse := haversine.Point{Lat: 38.89768, Lon: -77.03653}
	eighteenAndF := haversine.Point{Lat: 38.89736, Lon: -77.04173}

	fmt.Printf("%f\n", float64(whiteHouse.MetresTo(eighteenAndF)))
	/* 451.41 Metres (float64) */
}
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.