Skip to content

benjamintd/cheap-ruler-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

godoc Build Status Go Report Card

cheapRuler

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

Usage

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

License

MIT

See also

https://github.com/mapbox/cheap-ruler https://github.com/JamesMilnerUK/cheap-ruler-go

About

Golang port of @mourner's cheap-ruler

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages