Position Converter – a ruby gem for converting between various position units.
This package contains Position Converter, which converts latitudes and longitudes into various units.
Position Converter contains the following features:
-
Liberal position input format, handling white space and commas appropriately
-
Accepts input in any one of the four most common formats and convertes to the others; decimal degrees, NMEA, degrees/minutes/seconds and hundred thousandths of a millarc second.
Installation
Position Converter can be installed as a gem from RubyGems. If Gemcutter is not listed as one of your sources, do this ONCE. You can check with the –list option first.
gem sources --list
gem sources -a http://rubygems.org
Then, install.
sudo gem install poscvt
Sample Usage
require 'rubygems'
require 'poscvt'
begin
p = PosCvt.new('30.12893 , -102.39876')
print " Decimal Degrees: ", p.decimal_degrees, "\n"
print " 1.0e-5 Arc Min: ", p.htarc_minute, "\n"
print "NMEA (DDDMM.MMMM): ", p.nmea, "\n"
print " DDD.MM.SS: ", p.dms, "\n"
rescue PositionConversionException => e
puts e.to_s
end
The output is:
Decimal Degrees: 30.12893, -102.39876
1.0e-5 Arc Min: 180773580, -614392560
NMEA (DDDMM.MMMM): 3007.7358,N,10223.9256,W
DDD.MM.SS: 30.7.44,-102.23.56
Development
Source Repository
Position Converter is currently hosted at github. The github web page is github.com/kookjr/PositionConverter. The public git clone URL is
-
git://github.com/kookjr/PositionConverter.git
Running the Test Suite
Unit tests can be run with the following command.
ruby -Ilib test/tc_poscvt.rb
Issues and Bug Reports
Report and follow issue status at the project’s GitHub site.
http://github.com/kookjr/PositionConverter/issues
License
GNU General Public License version 3. For details, see file “COPYING”.