Cheap Ruler Go Save

📏 cheapruler in Go: fast geodesic measurements

Project README

Cheapruler (Go)

godoc reference

"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."

Usage

Here is an example of doing a distance measurement in kilometers, with a ruler Latitude of 32.8351:


cr, _ := NewCheapruler(32.8351, "kilometers")
pointA := []float64{-96.920341, 32.838261}
pointB := []float64{-96.920421, 32.838295}
dist := cr.Distance(pointA, pointB)
fmt.Println(dist)
// Output: 0.008385790760648736

Acknowledgements

Based on Vladimir Agafonkin's JavaScript library cheapruler

License

ISC License

Open Source Agenda is not affiliated with "Cheap Ruler Go" Project. README Source: JamesLMilner/cheap-ruler-go

Open Source Agenda Badge

Open Source Agenda Rating