silva 0.0.3 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/silva/system/co_ordinate.rb +1 -1
- data/lib/silva/system/en.rb +1 -1
- data/lib/silva/system/gridref.rb +1 -1
- data/lib/silva/version.rb +1 -1
- data/lib/silva.rb +29 -4
- data/test/test_gridref.rb +8 -0
- metadata +1 -1
data/lib/silva/system/en.rb
CHANGED
data/lib/silva/system/gridref.rb
CHANGED
data/lib/silva/version.rb
CHANGED
data/lib/silva.rb
CHANGED
@@ -1,5 +1,30 @@
|
|
1
|
-
|
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
|
-
|
4
|
-
|
5
|
-
|
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 }
|