[ANN] geodesic 1.0.0 released

M

Mathew Cucuzella

geodesic version 1.0.0 has been released!

* <http://github.com/kookjr/geodesic>

Geodesic is a Ruby library for calculating distance and bearing on the
Earth's surface using longitude and latitude. I found it helpful in
some basic position management applications. See README at above site
for install instructions.


Geodesic contains the following features:
* A Position class to encapsulate an Earth position
(latitude and longitude)
* A method to calculate the distance between two positions
using Haversine formula
* A method to calculate the distance between two positions
using the Law of Cosines
* A method to calculate the initial bearing between two positions
* A method to calculate a position a given distance from another
position along a bearing


Sample Usage
require 'rubygems'
require 'geodesic'

fremont = Geodesic::position.new(37.549531, -121.998711)
farmington = Geodesic::position.new(37.923482, -121.015263)

d = Geodesic::dist_haversine(fremont.lat, fremont.lon, farmington.lat,
farmington.lon)
print "distance from Fremont to Farmington is ", d, " kilometers\n"

b = Geodesic::bearing(fremont.lat, fremont.lon, farmington.lat,
farmington.lon)
print "bearing is ", b, " degrees\n"

p = Geodesic::dest_position(fremont.lat, fremont.lon, b, d + 10)
print "10 kilometers beyond farmington is ", p.lat, ", ", p.lon, "\n"

The output is:
distance from Fremont to Farmington is 95.957632116596 kilometers
bearing is 64.0206814526114 degrees
10 kilometers beyond farmington is 37.9619800970259, -120.912203460738


Credits
The original author of the JavaScript implementation, Chris Veness,
can be found at:
http://www.movable-type.co.uk/scripts/latlong.html

License
GNU LGPL, Lesser General Public License version 2.1. For details,
see file "COPYING.LESSER".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top