[ANN] geodesic 1.0.0 released

geodesic version 1.0.0 has been released!

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs