Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

github.com/jamesmilneruk/cheap-ruler-go

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

github.com/jamesmilneruk/cheap-ruler-go

  • v0.0.0-20191212211616-0919b75413a9
  • Source
  • Go
  • Socket score

Version published
Created
Source

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

FAQs

Package last updated on 12 Dec 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc