项目作者: JamesLMilner

项目描述 :
📏 cheapruler in Go: fast geodesic measurements
高级语言: Go
项目地址: git://github.com/JamesLMilner/cheap-ruler-go.git
创建时间: 2017-08-25T08:09:47Z
项目社区:https://github.com/JamesLMilner/cheap-ruler-go

开源协议:

下载


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:

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

Acknowledgements

Based on Vladimir Agafonkin‘s JavaScript library cheapruler

License

ISC License