A Golang port of @mourner's cheap-ruler:
"A collection of very fast approximations to common geodesic measurements. Useful for performance-sensitive code that measures things on a city scale.
The approximations are based on an FCC-approved formula of ellipsoidal Earth projection. For distances under 500 kilometers and not on the poles, the results are very precise — within 0.1% margin of error compared to Vincenti formulas, and usually much less for shorter distances."
package main
import (
"github.com/benjamintd/cheap-ruler-go/cheapRuler"
"fmt"
)
func main() {
// latitude of Paris
ruler, _ := cheapRuler.NewRuler(48.8629, "meters")
a := [2]float64{2.344808, 48.862851}
b := [2]float64{2.352790, 48.862907}
distance := ruler.Distance(a, b)
fmt.Println(distance)
}
// 585.71 meters
MIT
https://github.com/mapbox/cheap-ruler https://github.com/JamesMilnerUK/cheap-ruler-go