northern_pike 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.ruby-version +1 -0
- data/README.md +12 -4
- data/bin/console +1 -0
- data/lib/northern_pike.rb +27 -20
- data/lib/northern_pike/version.rb +1 -1
- data/northern_pike.gemspec +10 -9
- metadata +34 -33
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 87ac4cb5ac3a1d39c4ef6d4aa722e4f99f5cee96
|
4
|
+
data.tar.gz: cd1ec2f7412a2e894213145b54aeb53a17089e03
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 451a906add38f304811f4446fc208737b12b33270367909e189e5aa70e4e69723a61e77fbbf03953bc4a92caa6787bfe530993f69d61e9c1a715992580f07abd
|
7
|
+
data.tar.gz: 23c89ae49b1b948dfb67ec493f8ac1d3e3fcabf9e3af85d5d82f17f58c126c37d47f4fbcd90715c10d32cc27c9d825998a5a8f80821b0117e2dbc66b489acc49
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.4.2
|
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# Northern Pike
|
2
2
|
|
3
|
-
|
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
|
-
|
32
|
+
```ruby
|
28
33
|
|
29
|
-
|
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.
|
data/bin/console
CHANGED
data/lib/northern_pike.rb
CHANGED
@@ -4,26 +4,33 @@ require 'global_convert'
|
|
4
4
|
require 'os_map_ref'
|
5
5
|
|
6
6
|
module NorthernPike
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
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
|
-
|
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
|
data/northern_pike.gemspec
CHANGED
@@ -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 = '
|
12
|
-
spec.description = '
|
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', '
|
35
|
-
spec.add_development_dependency 'byebug'
|
36
|
-
spec.add_development_dependency 'rake', '
|
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
|
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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
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:
|
111
|
-
description:
|
112
|
-
|
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.
|
152
|
+
rubygems_version: 2.6.13
|
152
153
|
signing_key:
|
153
154
|
specification_version: 4
|
154
|
-
summary:
|
155
|
-
|
155
|
+
summary: Converts latitude,longitude to an OS map reference and an OS map reference
|
156
|
+
to latitude,longitude
|
156
157
|
test_files: []
|