silva 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in silva.gemspec
4
+ gemspec
data/README.md ADDED
@@ -0,0 +1,36 @@
1
+ What is Silva?
2
+ =============
3
+ A RubyGem which provides utilities to convert between the WGS84 standard for location information (as used by Google Maps, the GPS system, etc.) and the UK Ordnance Survey's OSGB36 datum, easting/northing format and standard grid references.
4
+
5
+ How do I use it?
6
+ ================
7
+ `gem install silva`
8
+
9
+ `require 'silva'`
10
+
11
+ `Silva::Location.from(:wgs84, :lat => 52.658008, :long => 1.716077).to(:gridref)`
12
+
13
+ `"TG51411318"``
14
+
15
+ What else can it do?
16
+ ===================
17
+ Silva works with four different location systems:
18
+
19
+ - WGS84 `(:wgs84, :lat => [latitude], :long => [longitude], :alt => [optional altitude])`
20
+ - OSGB36 `(:osgb36, params as above)`
21
+ - EN `(:en, :easting => [easting], :northing => [northing])`
22
+ - GridRef `(:gridref, :gridref => [gridref] OR :easting => [easting], :northing => [northing])`
23
+
24
+ It can convert freely among each of them using the syntax Silva::Location.from(:system, params).to(:system, params).
25
+
26
+ Why did you write it?
27
+ =====================
28
+ I needed to convert between WGS84 co-ordinates and Ordnance Survey grid references, and nothing out there quite did what I wanted (although see below). I'm also beginning with Ruby and wanted to get familiar with the idioms and best practices, so creating a gem seemed like a good way to do that.
29
+
30
+ Anything else?
31
+ =============
32
+ I began with code written by (Harry Wood)[http://www.harrywood.co.uk/blog/2010/06/29/ruby-code-for-converting-to-uk-ordnance-survey-coordinate-systems-from-wgs84], who adapted code written by (Chris Veness)[http://www.movable-type.co.uk/scripts/latlong-convert-coords.html]. I subsequently went back over the maths to make sure I understood it reasonably well, and clarified it so that it's easy to check against the resources supplied by the Ordnance Survey. Some of Chris's and Harry's code is probably still lurking in there.
33
+
34
+ It should be accurate to about 5 to 10 metres.
35
+
36
+ Silva was written as part of my (MSc Project)[http://rdallsgray.github.com/archie-blog], of which more later.
data/Rakefile ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env rake
2
+ require "bundler/gem_tasks"
@@ -0,0 +1,3 @@
1
+ module Silva
2
+ VERSION = "0.0.1"
3
+ end
data/lib/silva.rb ADDED
@@ -0,0 +1,5 @@
1
+ require "silva/version"
2
+
3
+ module Silva
4
+ # Your code goes here...
5
+ end
data/silva.gemspec ADDED
@@ -0,0 +1,21 @@
1
+ # -*- encoding: utf-8 -*-
2
+ require File.expand_path('../lib/silva/version', __FILE__)
3
+
4
+ Gem::Specification.new do |gem|
5
+ gem.authors = ["Robert Dallas Gray"]
6
+ gem.email = ["mail@robertdallasgray.com"]
7
+ gem.summary = "Convert between the GPS (WGS84) location standard and UK Ordnance Survey standards."
8
+ gem.description = "Silva converts location data to and from WGS84, OSGB36, eastings/northings and standard OS grid references."
9
+ gem.homepage = "http://github.com/rdallasgray/silva"
10
+ gem.license = "FreeBSD"
11
+ gem.required_ruby_version = ">= 1.9"
12
+ gem.add_development_dependency "test/unit"
13
+
14
+
15
+ gem.files = `git ls-files`.split($\)
16
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
+ gem.name = "silva"
19
+ gem.require_paths = ["lib"]
20
+ gem.version = Silva::VERSION
21
+ end
metadata ADDED
@@ -0,0 +1,72 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: silva
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Robert Dallas Gray
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2012-06-15 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: test/unit
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :development
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ description: Silva converts location data to and from WGS84, OSGB36, eastings/northings
31
+ and standard OS grid references.
32
+ email:
33
+ - mail@robertdallasgray.com
34
+ executables: []
35
+ extensions: []
36
+ extra_rdoc_files: []
37
+ files:
38
+ - .gitignore
39
+ - Gemfile
40
+ - README.md
41
+ - Rakefile
42
+ - lib/silva.rb
43
+ - lib/silva/version.rb
44
+ - silva.gemspec
45
+ homepage: http://github.com/rdallasgray/silva
46
+ licenses:
47
+ - FreeBSD
48
+ post_install_message:
49
+ rdoc_options: []
50
+ require_paths:
51
+ - lib
52
+ required_ruby_version: !ruby/object:Gem::Requirement
53
+ none: false
54
+ requirements:
55
+ - - ! '>='
56
+ - !ruby/object:Gem::Version
57
+ version: '1.9'
58
+ required_rubygems_version: !ruby/object:Gem::Requirement
59
+ none: false
60
+ requirements:
61
+ - - ! '>='
62
+ - !ruby/object:Gem::Version
63
+ version: '0'
64
+ requirements: []
65
+ rubyforge_project:
66
+ rubygems_version: 1.8.23
67
+ signing_key:
68
+ specification_version: 3
69
+ summary: Convert between the GPS (WGS84) location standard and UK Ordnance Survey
70
+ standards.
71
+ test_files: []
72
+ has_rdoc: