No commit activity in last 3 years
No release in over 3 years
Calculate the geographical distance between 2 points with extreme accuracy.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

Vincenty

Calculate the geographical distance (in meters) between 2 points with extreme accuracy.

This library implements Vincenty's solution to the inverse geodetic problem. It is based on the WGS 84 reference ellipsoid and is accurate to within 1 mm (!) or better.

This formula is widely used in geographic information systems (GIS) and is much more accurate than methods for computing the great-circle distance (which assume a spherical Earth).

Installation

Include the gem in your Gemfile:

gem 'vincenty_distance'

or

$ gem install vincenty_distance

and

require 'vincenty'

Example: distance between Boston and New York City

require 'vincenty'

boston  = { latitude: 42.3541165, longitude: -71.0693514 }
newyork = { latitude: 40.7791472, longitude: -73.9680804 }

distance = Vincenty.distance_between_points(boston, newyork)

# distance =  298_396.057 m

References

Wikipedia: Vincenty's formulae

Wikipedia: World Geodetic System

Python implementation