northern_pike 0.0.1 → 0.1.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1aa04ecd901268fc2abf8d3679a13ad85cfbdfeb
4
- data.tar.gz: dab2dbb55e5e9cecdf5b9567b5aba22ad4c9db37
3
+ metadata.gz: 87ac4cb5ac3a1d39c4ef6d4aa722e4f99f5cee96
4
+ data.tar.gz: cd1ec2f7412a2e894213145b54aeb53a17089e03
5
5
  SHA512:
6
- metadata.gz: dcdd18f7302b70d6ea9ce732146bb7eff7b219c126fa9fca77950a4b62b3365399e9e315c41213de67d0e2edea3f023fddf6e906c92def46c83767e6bc1de240
7
- data.tar.gz: 0a167909896e56c3b63b2b30b119c10bcad44b8b1d60633a8b73d2b0c594f1fd26d9f50c31eee6286e2c709a24db67b98fbf4e55a478630b83934863121bf2ac
6
+ metadata.gz: 451a906add38f304811f4446fc208737b12b33270367909e189e5aa70e4e69723a61e77fbbf03953bc4a92caa6787bfe530993f69d61e9c1a715992580f07abd
7
+ data.tar.gz: 23c89ae49b1b948dfb67ec493f8ac1d3e3fcabf9e3af85d5d82f17f58c126c37d47f4fbcd90715c10d32cc27c9d825998a5a8f80821b0117e2dbc66b489acc49
@@ -0,0 +1 @@
1
+ 2.4.2
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Northern Pike
2
2
 
3
- Chomps on some text containing OS Refs, titles and a descriptions for waters and spits out an array of waters containing a title, a descriptions and a lat,lng.
3
+ Converts latitude,longitude to an OS map reference and an OS map reference to latitude,longitude
4
4
 
5
5
  ![Northern Pike](https://upload.wikimedia.org/wikipedia/commons/thumb/c/c5/Esox_lucius1.jpg/1200px-Esox_lucius1.jpg "Northern Pike")
6
6
 
@@ -23,10 +23,17 @@ Or install it yourself as:
23
23
 
24
24
  ## Usage
25
25
 
26
+ ```ruby
27
+ NorthernPike.os_ref_to_lat_lng(os_ref: 'HU260490')
28
+
29
+ {:lat=>60.22449375779038, :lng=>-1.5325017342359533}
30
+
26
31
  ```
27
- string_of_text = File.read(Dir.pwd + '/waters.txt')
32
+ ```ruby
28
33
 
29
- northern_pike.chomp text: string_of_text, grid_letters: 'HU'
34
+ NorthernPike.lat_lng_to_os_ref(lat: 60.22449375779038, lng: -1.5325017342359533)
35
+
36
+ {:os_map_ref=>"HU 26000 49000"}
30
37
 
31
38
  ```
32
39
 
@@ -37,6 +44,7 @@ After checking out the repo, run `bin/setup` to install dependencies. You can al
37
44
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
38
45
 
39
46
  ## Contributing
40
-
41
47
  Bug reports and pull requests are welcome on GitHub at https://github.com/Steven/northern_pike.
42
48
 
49
+ ## License
50
+ This code is free to use under the terms of the MIT license.
@@ -2,6 +2,7 @@
2
2
 
3
3
  require "bundler/setup"
4
4
  require "northern_pike"
5
+ require "byebug"
5
6
 
6
7
  # You can add fixtures and/or initialization code here to make experimenting
7
8
  # with your gem easier. You can also use a different console, if you like.
@@ -4,26 +4,33 @@ require 'global_convert'
4
4
  require 'os_map_ref'
5
5
 
6
6
  module NorthernPike
7
- def self.os_reference_to_lat_lng(os_ref:, grid_letters: nil)
8
- ref = grid_letters ? grid_letters + ' ' + os_ref : os_ref
9
- os_location = OsMapRef::Location.for ref
10
- location = GlobalConvert::Location.new(
11
- input: {
12
- projection: :osgb36,
13
- lon: os_location.easting.to_i,
14
- lat: os_location.northing.to_i
15
- },
16
- output: {
17
- projection: :wgs84
18
- }
19
- )
20
- { lat: (location.lat * 180 / Math::PI), lng: (location.lon * 180 / Math::PI) }
21
- end
7
+ def self.os_ref_to_lat_lng(os_ref:)
8
+ os_location = OsMapRef::Location.for os_ref
9
+ location = GlobalConvert::Location.new(
10
+ input: {
11
+ projection: :osgb36,
12
+ lon: os_location.easting.to_i,
13
+ lat: os_location.northing.to_i
14
+ },
15
+ output: {
16
+ projection: :wgs84
17
+ }
18
+ )
19
+ { lat: (location.lat * 180 / Math::PI), lng: (location.lon * 180 / Math::PI) }
20
+ end
21
+
22
+ def self.lat_lng_to_os_ref(lat:, lng:)
23
+ location = GlobalConvert::Location.new(
24
+ input: {
25
+ projection: :wgs84,
26
+ lon: (Math::PI * lng.to_f / 180),
27
+ lat: (Math::PI * lat.to_f / 180)
28
+ },
29
+ output: {
30
+ projection: :osgb36
31
+ }
32
+ )
22
33
 
23
- def self.chomp(text:, grid_letters: nil)
24
- return nil if text.empty?
25
- text.split("\n").each_slice(3).to_a.map do |a|
26
- [a[0], a[2], os_reference_to_lat_lng(os_ref: a[1], grid_letters: grid_letters)]
34
+ { os_map_ref: OsMapRef::Location.for("#{location.lon},#{location.lat}").map_reference }
27
35
  end
28
- end
29
36
  end
@@ -1,3 +1,3 @@
1
1
  module NorthernPike
2
- VERSION = "0.0.1"
2
+ VERSION = "0.1.0"
3
3
  end
@@ -8,9 +8,10 @@ Gem::Specification.new do |spec|
8
8
  spec.authors = ['Steven']
9
9
  spec.email = ['stevenjamescook@gmail.com']
10
10
 
11
- spec.summary = 'Chomps on some text containing OS Refs, titles and a descriptions for waters and spits out an array of waters containing a title, a descriptions and a lat,lng.'
12
- spec.description = 'Chomps on some text containing OS Refs, titles and a descriptions for waters and spits out an array of waters containing a title, a descriptions and a lat,lng.'
11
+ spec.summary = 'Converts latitude,longitude to an OS map reference and an OS map reference to latitude,longitude'
12
+ spec.description = 'Converts latitude,longitude to an OS map reference and an OS map reference to latitude,longitude'
13
13
  spec.homepage = 'https://github.com/cookiescrumbs/northern-pike'
14
+ spec.license = 'MIT'
14
15
 
15
16
  # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
16
17
  # to allow pushing to a single host or delete this section to allow pushing to any host.
@@ -28,13 +29,13 @@ Gem::Specification.new do |spec|
28
29
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
29
30
  spec.require_paths = ['lib']
30
31
 
31
- spec.add_dependency 'global_convert'
32
- spec.add_dependency 'os_map_ref'
32
+ spec.add_dependency 'global_convert', '0.0.2'
33
+ spec.add_dependency 'os_map_ref', '0.5.0'
33
34
 
34
- spec.add_development_dependency 'bundler', '~> 1.14'
35
- spec.add_development_dependency 'byebug'
36
- spec.add_development_dependency 'rake', '~> 10.0'
37
- spec.add_development_dependency 'rspec'
38
- spec.add_development_dependency 'rubocop'
35
+ spec.add_development_dependency 'bundler', '1.14'
36
+ spec.add_development_dependency 'byebug', '11.1.1'
37
+ spec.add_development_dependency 'rake', '10.0'
38
+ spec.add_development_dependency 'rspec', '3.9.0'
39
+ spec.add_development_dependency 'rubocop', '0.79.0'
39
40
 
40
41
  end
metadata CHANGED
@@ -1,116 +1,115 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: northern_pike
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steven
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-01-20 00:00:00.000000000 Z
11
+ date: 2020-03-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: global_convert
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: 0.0.2
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: '0'
26
+ version: 0.0.2
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: os_map_ref
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: '0'
33
+ version: 0.5.0
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - '='
39
39
  - !ruby/object:Gem::Version
40
- version: '0'
40
+ version: 0.5.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - '='
46
46
  - !ruby/object:Gem::Version
47
47
  version: '1.14'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - '='
53
53
  - !ruby/object:Gem::Version
54
54
  version: '1.14'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: byebug
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ">="
59
+ - - '='
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: 11.1.1
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ">="
66
+ - - '='
67
67
  - !ruby/object:Gem::Version
68
- version: '0'
68
+ version: 11.1.1
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rake
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - '='
74
74
  - !ruby/object:Gem::Version
75
75
  version: '10.0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - '='
81
81
  - !ruby/object:Gem::Version
82
82
  version: '10.0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rspec
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ">="
87
+ - - '='
88
88
  - !ruby/object:Gem::Version
89
- version: '0'
89
+ version: 3.9.0
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ">="
94
+ - - '='
95
95
  - !ruby/object:Gem::Version
96
- version: '0'
96
+ version: 3.9.0
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: rubocop
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ">="
101
+ - - '='
102
102
  - !ruby/object:Gem::Version
103
- version: '0'
103
+ version: 0.79.0
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ">="
108
+ - - '='
109
109
  - !ruby/object:Gem::Version
110
- version: '0'
111
- description: Chomps on some text containing OS Refs, titles and a descriptions for
112
- waters and spits out an array of waters containing a title, a descriptions and a
113
- lat,lng.
110
+ version: 0.79.0
111
+ description: Converts latitude,longitude to an OS map reference and an OS map reference
112
+ to latitude,longitude
114
113
  email:
115
114
  - stevenjamescook@gmail.com
116
115
  executables: []
@@ -121,6 +120,7 @@ files:
121
120
  - ".gitignore"
122
121
  - ".rspec"
123
122
  - ".rubocop.yml"
123
+ - ".ruby-version"
124
124
  - Gemfile
125
125
  - README.md
126
126
  - Rakefile
@@ -130,7 +130,8 @@ files:
130
130
  - lib/northern_pike/version.rb
131
131
  - northern_pike.gemspec
132
132
  homepage: https://github.com/cookiescrumbs/northern-pike
133
- licenses: []
133
+ licenses:
134
+ - MIT
134
135
  metadata: {}
135
136
  post_install_message:
136
137
  rdoc_options: []
@@ -148,9 +149,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
148
149
  version: '0'
149
150
  requirements: []
150
151
  rubyforge_project:
151
- rubygems_version: 2.6.12
152
+ rubygems_version: 2.6.13
152
153
  signing_key:
153
154
  specification_version: 4
154
- summary: Chomps on some text containing OS Refs, titles and a descriptions for waters
155
- and spits out an array of waters containing a title, a descriptions and a lat,lng.
155
+ summary: Converts latitude,longitude to an OS map reference and an OS map reference
156
+ to latitude,longitude
156
157
  test_files: []