silva 0.0.3 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -17,7 +17,7 @@ module Silva
17
17
 
18
18
  attr_reader :lat, :long, :alt
19
19
 
20
- def inspect
20
+ def to_s
21
21
  [lat, long, alt].to_s
22
22
  end
23
23
 
@@ -6,7 +6,7 @@ module Silva
6
6
  class En < Base
7
7
  include OsEn
8
8
 
9
- def inspect
9
+ def to_s
10
10
  [easting, northing].to_s
11
11
  end
12
12
 
@@ -52,7 +52,7 @@ module Silva
52
52
  @gridref
53
53
  end
54
54
 
55
- def inspect
55
+ def to_s
56
56
  gridref
57
57
  end
58
58
 
data/lib/silva/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Silva
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.5"
3
3
  end
data/lib/silva.rb CHANGED
@@ -1,5 +1,30 @@
1
- require "silva/version"
1
+ # Silva makes it simple to convert WGS84 (GPS) location data to and from the UK
2
+ # Ordnance Survey OSGB36 formats (grid references, eastings/northings, and longitude/latitude).
3
+ #
4
+ # Silva was inspired by the work of Chris Veness and Harry Wood:
5
+ # http://www.movable-type.co.uk/scripts/latlong-convert-coords.html
6
+ # http://www.harrywood.co.uk/blog/2010/06/29/ruby-code-for-converting-to-uk-ordnance-survey-coordinate-systems-from-wgs84/
7
+ #
8
+ # Portions of Harry's code remain, especially in Silva::Transform::helmert_transform,
9
+ # but algorithms have been clarified so as to be easily comparable with those given by
10
+ # Ordnance Survey.
11
+ #
12
+ # Usage:
13
+ # location = Silva::Location.from(:wgs84, data[:wgs84]).to(:gridref, :digits => 8)
14
+ #
15
+ # Author:: Robert Dallas Gray
16
+ # Copyright:: Copyright (c) 2012 Robert Dallas Gray
17
+ # Requires:: Ruby 1.9
18
+ # License:: Provided under the FreeBSD License (http://www.freebsd.org/copyright/freebsd-license.html)
2
19
 
3
- module Silva
4
- # Your code goes here...
5
- end
20
+ require_relative 'silva/version'
21
+ require_relative 'silva/exception'
22
+ require_relative 'silva/location'
23
+ require_relative 'silva/transform'
24
+ require_relative 'silva/system/base'
25
+ require_relative 'silva/system/co_ordinate'
26
+ require_relative 'silva/system/osen'
27
+ require_relative 'silva/system/wgs84'
28
+ require_relative 'silva/system/osgb36'
29
+ require_relative 'silva/system/en'
30
+ require_relative 'silva/system/gridref'
data/test/test_gridref.rb CHANGED
@@ -1,4 +1,12 @@
1
1
  class TestGridref < Test::Unit::TestCase
2
+ def test_inspect_gridref
3
+ Silva::Test::DATA.each do |data|
4
+ options = { :gridref => data[:gridref], :digits => 8 }
5
+ l = Silva::Location.from(:gridref, options)
6
+ assert_equal(data[:gridref], l.to_s)
7
+ end
8
+ end
9
+
2
10
  def test_gridref_to_en
3
11
  Silva::Test::DATA.each do |data|
4
12
  options = { :gridref => data[:gridref], :digits => 8 }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: silva
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.5
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: