tony2001 / go-haversine

Haversine distance between two points

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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) */
}

About

Haversine distance between two points

License:MIT License


Languages

Language:Go 100.0%