glw 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.
Files changed (6) hide show
  1. checksums.yaml +7 -0
  2. checksums.yaml.gz.sig +1 -0
  3. data/lib/glw.rb +44 -0
  4. data.tar.gz.sig +2 -0
  5. metadata +108 -0
  6. metadata.gz.sig +0 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 2613af8ce2913e817e7a0e8db07c94068ee0f4ae
4
+ data.tar.gz: 3877ec506ac75a6127fff8d457ced30ada2be8d9
5
+ SHA512:
6
+ metadata.gz: ec04f14c974cd8490b3309eb1ab226c1c14c6034ffc92fa7ba76f0fcbbedf4e81a9d60f9ee28d87bdaee0f2a1ae73368a8caa286ebc64f888beff62c85ec0931
7
+ data.tar.gz: 8dbf1817a4c72ff547f3d46bdae5c97f5550321304d4e59e75315d718e6546234e24cdbad35d73948c903d1f8eececa5c5ef553993069c475b0d02e0deaaf882
checksums.yaml.gz.sig ADDED
@@ -0,0 +1 @@
1
+ >�g�8��SEuӪ���5Fe(ipa���������=�8?�'�k���~��O��Oz���/�������gx����v�$F�=����5F���̿�ͥ��"��@_���hH/�R��D�]|[i���������r�:��Y<���)IP��3��x�����}O#;�n�$����~,��0w���~���������P#�*�� F�/���:��¨�j/�Y��P2�MG���s��;"�΍u
data/lib/glw.rb ADDED
@@ -0,0 +1,44 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ # file: geolocate.rb
4
+
5
+
6
+ require 'geocoder'
7
+ require 'geodesic'
8
+
9
+
10
+ class Geolocate
11
+
12
+ def initialize()
13
+ Geocoder.configure(:timeout => 3)
14
+ end
15
+
16
+ def locate(lat, lon)
17
+
18
+ s = "%s, %s" % [lat, lon]
19
+ r = Geocoder.search s
20
+
21
+ p1 = Geodesic::Position.new(lat, lon)
22
+ place = Geodesic::Position.new(*r[0].coordinates)
23
+
24
+ d = Geodesic::dist_haversine(place.lat, place.lon, p1.lat, p1.lon).round(3)
25
+ b = Geodesic::bearing(place.lat, place.lon, p1.lat, p1.lon).round
26
+
27
+ fields = %i(address city coordinates country postal_code route
28
+ street_number types)
29
+
30
+ h = fields.inject({}) do |hash, x|
31
+ hash.merge(x => r[0].method(x).call)
32
+ end
33
+
34
+ h.merge({relative_distance: d, relative_bearing: b})
35
+ end
36
+ end
37
+
38
+
39
+ if __FILE__ == $0 then
40
+
41
+ gl = Geolocate.new
42
+ puts gl.locate(*ARGV).inspect
43
+
44
+ end
data.tar.gz.sig ADDED
@@ -0,0 +1,2 @@
1
+ I���b
2
+ K�IM11�ڋ�i�d^�+J2�ܮ�"u'Ҟ{\��En�j���Z�K������oC �K�a���wf�w�]��+���r�?}�"j*Tx���=<�d�������y���mp��з��B���ߑ�����U��1��}@�� �� -<�4�� 8</�8͜��9b]I�{f�=- %y=��
metadata ADDED
@@ -0,0 +1,108 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: glw
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - James Robertson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIDljCCAn6gAwIBAgIBATANBgkqhkiG9w0BAQUFADBIMRIwEAYDVQQDDAlnZW1t
14
+ YXN0ZXIxHjAcBgoJkiaJk/IsZAEZFg5qYW1lc3JvYmVydHNvbjESMBAGCgmSJomT
15
+ 8ixkARkWAmV1MB4XDTE3MDYyMzE3Mzg1NloXDTE4MDYyMzE3Mzg1NlowSDESMBAG
16
+ A1UEAwwJZ2VtbWFzdGVyMR4wHAYKCZImiZPyLGQBGRYOamFtZXNyb2JlcnRzb24x
17
+ EjAQBgoJkiaJk/IsZAEZFgJldTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoC
18
+ ggEBAMyU3ekZliFGEvZaPeJjA17mH9q70WFhIMuakwSIHSmwZ0Uha2Uxj3E/tuAr
19
+ TcfTkQ9wZdM5pUVr0K/IhZqiv2fR1qVJ9IapJo0uV1O6ldcp7Ns8nI5ISSkrnDHy
20
+ +Nt2YEokh2kRHe4hD0+bptNfyiTnTCdMfnVRfJ97JZSFgnfeytebLY7RyOyl5i/m
21
+ 1d0ojotG+cJidFsgiAbVoxPPGAW6H9aMjVKtBg0gk1hXG1ayDdO6ltad2RUMLZIC
22
+ Xh9E8uUy3Hllu6VIMrt3aGvi730euQeN7SHVRYElQ9H7WJA+kfPfGDsdkQA8CJrp
23
+ OGPo+gUUQtLWiMjp6rz7AJMiXb0CAwEAAaOBijCBhzAJBgNVHRMEAjAAMAsGA1Ud
24
+ DwQEAwIEsDAdBgNVHQ4EFgQUMuKn4u0EBeFDuqPPoBXMIledsiIwJgYDVR0RBB8w
25
+ HYEbZ2VtbWFzdGVyQGphbWVzcm9iZXJ0c29uLmV1MCYGA1UdEgQfMB2BG2dlbW1h
26
+ c3RlckBqYW1lc3JvYmVydHNvbi5ldTANBgkqhkiG9w0BAQUFAAOCAQEAWhV3Lhi8
27
+ ExvQqXVKcduiQAjjKQkF2rZnOrb00FxlrhSGONhasKpYHYTvvkEpYWjQZ8mCrDIq
28
+ j8rB4uxK6H2DwUmyu5TrlMKZ4yte350OQB2F4faz25YsV5dkGAyQkskx5y2ouEsk
29
+ H1yQS62wso9ddTvWFrpTqIX6QG+/eizE7+QrJFmjCwuruvISA+PTlN5NtFXPF0Xj
30
+ yHFzoRdHrr8FYv+KM8rZHWAKoSjlKflwVJJAZ4BlAidGJQa94Lsrf4FlVOUbsvN9
31
+ VjRGNrP/e8DzppPHs0UL/CzbWYLyfrBZUJpbNIFlzu6g62M1vkvpzwoC12eXHyET
32
+ uLwQN+MzhB3/YA==
33
+ -----END CERTIFICATE-----
34
+ date: 2017-06-23 00:00:00.000000000 Z
35
+ dependencies:
36
+ - !ruby/object:Gem::Dependency
37
+ name: geocoder
38
+ requirement: !ruby/object:Gem::Requirement
39
+ requirements:
40
+ - - "~>"
41
+ - !ruby/object:Gem::Version
42
+ version: '1.4'
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: 1.4.4
46
+ type: :runtime
47
+ prerelease: false
48
+ version_requirements: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - "~>"
51
+ - !ruby/object:Gem::Version
52
+ version: '1.4'
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: 1.4.4
56
+ - !ruby/object:Gem::Dependency
57
+ name: geodesic
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: '1.0'
63
+ - - ">="
64
+ - !ruby/object:Gem::Version
65
+ version: 1.0.1
66
+ type: :runtime
67
+ prerelease: false
68
+ version_requirements: !ruby/object:Gem::Requirement
69
+ requirements:
70
+ - - "~>"
71
+ - !ruby/object:Gem::Version
72
+ version: '1.0'
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: 1.0.1
76
+ description:
77
+ email: james@jamesrobertson.eu
78
+ executables: []
79
+ extensions: []
80
+ extra_rdoc_files: []
81
+ files:
82
+ - lib/glw.rb
83
+ homepage: https://github.com/jrobertson/glw
84
+ licenses:
85
+ - MIT
86
+ metadata: {}
87
+ post_install_message:
88
+ rdoc_options: []
89
+ require_paths:
90
+ - lib
91
+ required_ruby_version: !ruby/object:Gem::Requirement
92
+ requirements:
93
+ - - ">="
94
+ - !ruby/object:Gem::Version
95
+ version: '0'
96
+ required_rubygems_version: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ version: '0'
101
+ requirements: []
102
+ rubyforge_project:
103
+ rubygems_version: 2.6.8
104
+ signing_key:
105
+ specification_version: 4
106
+ summary: 'A wrapper for the geocoder gem to returns the place name and more for a
107
+ given longitude and latitude. #gps #geolocation'
108
+ test_files: []
metadata.gz.sig ADDED
Binary file