geokit 1.10.0 → 1.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.hound.yml +2 -0
- data/.rubocop.yml +358 -0
- data/.travis.yml +4 -4
- data/CHANGELOG.md +16 -0
- data/Gemfile +3 -3
- data/README.markdown +19 -4
- data/Rakefile +11 -16
- data/fixtures/keys.yml +9 -0
- data/fixtures/vcr_cassettes/google_postal_town.yml +117 -0
- data/fixtures/vcr_cassettes/mapbox_forward_geocode.yml +30 -30
- data/fixtures/vcr_cassettes/mapbox_forward_geocode_city_only.yml +25 -25
- data/fixtures/vcr_cassettes/mapbox_forward_geocode_state_only.yml +71 -0
- data/fixtures/vcr_cassettes/mapbox_reverse_geocode.yml +25 -25
- data/fixtures/vcr_cassettes/test_component_filtering_off.yml +390 -0
- data/fixtures/vcr_cassettes/test_component_filtering_on.yml +164 -0
- data/fixtures/vcr_cassettes/test_component_filtering_on_without_filter.yml +404 -0
- data/geokit.gemspec +24 -23
- data/lib/geokit.rb +7 -7
- data/lib/geokit/core_ext.rb +1 -1
- data/lib/geokit/geo_loc.rb +25 -19
- data/lib/geokit/geocoders.rb +21 -30
- data/lib/geokit/geocoders/bing.rb +5 -4
- data/lib/geokit/geocoders/ca_geocoder.rb +10 -11
- data/lib/geokit/geocoders/fcc.rb +9 -9
- data/lib/geokit/geocoders/free_geo_ip.rb +8 -8
- data/lib/geokit/geocoders/geo_plugin.rb +7 -7
- data/lib/geokit/geocoders/geobytes.rb +10 -10
- data/lib/geokit/geocoders/geocodio.rb +14 -14
- data/lib/geokit/geocoders/geonames.rb +12 -12
- data/lib/geokit/geocoders/google.rb +89 -61
- data/lib/geokit/geocoders/ip.rb +9 -14
- data/lib/geokit/geocoders/mapbox.rb +30 -30
- data/lib/geokit/geocoders/mapquest.rb +12 -12
- data/lib/geokit/geocoders/maxmind.rb +1 -1
- data/lib/geokit/geocoders/opencage.rb +19 -19
- data/lib/geokit/geocoders/openstreetmap.rb +21 -19
- data/lib/geokit/geocoders/ripe.rb +7 -7
- data/lib/geokit/geocoders/us_geocoder.rb +5 -5
- data/lib/geokit/geocoders/yahoo.rb +46 -46
- data/lib/geokit/geocoders/yandex.rb +18 -17
- data/lib/geokit/inflectors.rb +5 -5
- data/lib/geokit/lat_lng.rb +5 -4
- data/lib/geokit/multi_geocoder.rb +4 -2
- data/lib/geokit/net_adapter/net_http.rb +3 -2
- data/lib/geokit/net_adapter/typhoeus.rb +2 -1
- data/lib/geokit/version.rb +1 -1
- data/test/coverage_loader.rb +25 -0
- data/test/helper.rb +18 -87
- data/test/test_base_geocoder.rb +44 -11
- data/test/test_bing_geocoder.rb +40 -48
- data/test/test_bounds.rb +1 -1
- data/test/test_ca_geocoder.rb +15 -15
- data/test/test_fcc_geocoder.rb +8 -9
- data/test/test_free_geo_ip_geocoder.rb +8 -10
- data/test/test_geo_plugin_geocoder.rb +21 -22
- data/test/test_geobytes_geocoder.rb +9 -11
- data/test/test_geocodio_geocoder.rb +12 -14
- data/test/test_geoloc.rb +48 -49
- data/test/test_geonames_geocoder.rb +19 -23
- data/test/test_google_geocoder.rb +197 -189
- data/test/test_inflector.rb +7 -7
- data/test/test_ipgeocoder.rb +32 -31
- data/test/test_latlng.rb +28 -28
- data/test/test_map_quest.rb +23 -27
- data/test/test_mapbox_geocoder.rb +38 -28
- data/test/test_mappable.rb +2 -2
- data/test/test_maxmind_geocoder.rb +16 -16
- data/test/test_multi_geocoder.rb +5 -5
- data/test/test_multi_ip_geocoder.rb +3 -3
- data/test/test_net_adapter.rb +4 -4
- data/test/test_opencage_geocoder.rb +58 -67
- data/test/test_openstreetmap_geocoder.rb +67 -65
- data/test/test_polygon.rb +4 -22
- data/test/test_ripe_geocoder.rb +21 -26
- data/test/test_us_geocoder.rb +21 -21
- data/test/test_useragent.rb +46 -0
- data/test/test_yahoo_geocoder.rb +35 -47
- data/test/test_yandex_geocoder.rb +29 -27
- data/test/vcr_loader.rb +18 -0
- metadata +20 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a65b885be9e9d49c301e1c027f0b67ed5b6c0cf5
|
4
|
+
data.tar.gz: 0a3f1ef269758d9647be947192d2137bc9239503
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4435c54ff2edb3ba749b2d8a2d5ed3a8a45fab5e22df8d3e1fd8a2da39a9ae30e6054f0c8f1a012d9dfe7cfd5677b02f9650234d3af708067766727a7e9dc94d
|
7
|
+
data.tar.gz: b87976064a7e40f5d65e9fe7dc4afa36677449d390b41f3f63ed403b99c8404e4e6599700e12a956175f5e35db599d15a443456448864b1efd12dadcbc16e499
|
data/.gitignore
CHANGED
data/.hound.yml
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,358 @@
|
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config`
|
3
|
+
# on 2016-10-10 22:51:36 +1030 using RuboCop version 0.39.0.
|
4
|
+
# The point is for the user to remove these configuration records
|
5
|
+
# one by one as the offenses are removed from the code base.
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
8
|
+
|
9
|
+
# Offense count: 113
|
10
|
+
Lint/IneffectiveAccessModifier:
|
11
|
+
Enabled: false
|
12
|
+
|
13
|
+
# Offense count: 21
|
14
|
+
Lint/UselessAccessModifier:
|
15
|
+
Enabled: false
|
16
|
+
|
17
|
+
# Offense count: 72
|
18
|
+
Metrics/AbcSize:
|
19
|
+
Max: 47
|
20
|
+
|
21
|
+
# Offense count: 5
|
22
|
+
# Configuration parameters: CountComments.
|
23
|
+
Metrics/ClassLength:
|
24
|
+
Max: 286
|
25
|
+
|
26
|
+
# Offense count: 8
|
27
|
+
Metrics/CyclomaticComplexity:
|
28
|
+
Max: 14
|
29
|
+
|
30
|
+
# Offense count: 314
|
31
|
+
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes.
|
32
|
+
# URISchemes: http, https
|
33
|
+
Metrics/LineLength:
|
34
|
+
Max: 186
|
35
|
+
|
36
|
+
# Offense count: 60
|
37
|
+
# Configuration parameters: CountComments.
|
38
|
+
Metrics/MethodLength:
|
39
|
+
Max: 35
|
40
|
+
|
41
|
+
# Offense count: 1
|
42
|
+
# Configuration parameters: CountComments.
|
43
|
+
Metrics/ModuleLength:
|
44
|
+
Max: 115
|
45
|
+
|
46
|
+
# Offense count: 5
|
47
|
+
Metrics/PerceivedComplexity:
|
48
|
+
Max: 14
|
49
|
+
|
50
|
+
# Offense count: 1
|
51
|
+
# Cop supports --auto-correct.
|
52
|
+
Performance/RedundantMatch:
|
53
|
+
Exclude:
|
54
|
+
- 'lib/geokit/multi_geocoder.rb'
|
55
|
+
|
56
|
+
# Offense count: 4
|
57
|
+
# Cop supports --auto-correct.
|
58
|
+
Performance/StringReplacement:
|
59
|
+
Exclude:
|
60
|
+
- 'lib/geokit/geocoders/geonames.rb'
|
61
|
+
- 'lib/geokit/geocoders/google.rb'
|
62
|
+
- 'lib/geokit/geocoders/yahoo.rb'
|
63
|
+
- 'lib/geokit/inflectors.rb'
|
64
|
+
|
65
|
+
# Offense count: 1
|
66
|
+
Style/AccessorMethodName:
|
67
|
+
Exclude:
|
68
|
+
- 'lib/geokit/geocoders/mapbox.rb'
|
69
|
+
|
70
|
+
# Offense count: 6
|
71
|
+
# Cop supports --auto-correct.
|
72
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
73
|
+
# SupportedStyles: prefer_alias, prefer_alias_method
|
74
|
+
Style/Alias:
|
75
|
+
Exclude:
|
76
|
+
- 'lib/geokit/geo_loc.rb'
|
77
|
+
- 'lib/geokit/lat_lng.rb'
|
78
|
+
- 'lib/geokit/mappable.rb'
|
79
|
+
|
80
|
+
# Offense count: 2
|
81
|
+
# Cop supports --auto-correct.
|
82
|
+
Style/AlignArray:
|
83
|
+
Exclude:
|
84
|
+
- 'lib/geokit/geo_loc.rb'
|
85
|
+
|
86
|
+
# Offense count: 4
|
87
|
+
# Cop supports --auto-correct.
|
88
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
89
|
+
# SupportedStyles: with_first_parameter, with_fixed_indentation
|
90
|
+
Style/AlignParameters:
|
91
|
+
Exclude:
|
92
|
+
- 'lib/geokit/lat_lng.rb'
|
93
|
+
- 'test/test_google_geocoder.rb'
|
94
|
+
|
95
|
+
# Offense count: 2
|
96
|
+
# Cop supports --auto-correct.
|
97
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
98
|
+
# SupportedStyles: always, conditionals
|
99
|
+
Style/AndOr:
|
100
|
+
Exclude:
|
101
|
+
- 'lib/geokit/lat_lng.rb'
|
102
|
+
- 'lib/geokit/mappable.rb'
|
103
|
+
|
104
|
+
# Offense count: 4
|
105
|
+
# Cop supports --auto-correct.
|
106
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
107
|
+
# SupportedStyles: braces, no_braces, context_dependent
|
108
|
+
Style/BracesAroundHashParameters:
|
109
|
+
Exclude:
|
110
|
+
- 'test/test_base_geocoder.rb'
|
111
|
+
- 'test/test_multi_ip_geocoder.rb'
|
112
|
+
- 'test/test_openstreetmap_geocoder.rb'
|
113
|
+
|
114
|
+
# Offense count: 12
|
115
|
+
Style/ClassVars:
|
116
|
+
Exclude:
|
117
|
+
- 'lib/geokit.rb'
|
118
|
+
- 'lib/geokit/geocoders.rb'
|
119
|
+
- 'test/helper.rb'
|
120
|
+
|
121
|
+
# Offense count: 2
|
122
|
+
# Cop supports --auto-correct.
|
123
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles, SingleLineConditionsOnly.
|
124
|
+
# SupportedStyles: assign_to_condition, assign_inside_condition
|
125
|
+
Style/ConditionalAssignment:
|
126
|
+
Exclude:
|
127
|
+
- 'lib/geokit/bounds.rb'
|
128
|
+
- 'lib/geokit/geocoders/yahoo.rb'
|
129
|
+
|
130
|
+
# Offense count: 15
|
131
|
+
Style/Documentation:
|
132
|
+
Exclude:
|
133
|
+
- 'spec/**/*'
|
134
|
+
- 'test/**/*'
|
135
|
+
- 'lib/geokit.rb'
|
136
|
+
- 'lib/geokit/core_ext.rb'
|
137
|
+
- 'lib/geokit/geocoders.rb'
|
138
|
+
- 'lib/geokit/geocoders/base_ip.rb'
|
139
|
+
- 'lib/geokit/geocoders/ca_geocoder.rb'
|
140
|
+
- 'lib/geokit/geocoders/fcc.rb'
|
141
|
+
- 'lib/geokit/geocoders/geocodio.rb'
|
142
|
+
- 'lib/geokit/geocoders/google.rb'
|
143
|
+
- 'lib/geokit/geocoders/us_geocoder.rb'
|
144
|
+
- 'lib/geokit/geocoders/yahoo.rb'
|
145
|
+
- 'lib/geokit/inflectors.rb'
|
146
|
+
- 'lib/geokit/lat_lng.rb'
|
147
|
+
- 'lib/geokit/net_adapter/net_http.rb'
|
148
|
+
- 'lib/geokit/net_adapter/typhoeus.rb'
|
149
|
+
|
150
|
+
# Offense count: 4
|
151
|
+
# Cop supports --auto-correct.
|
152
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
153
|
+
# SupportedStyles: leading, trailing
|
154
|
+
Style/DotPosition:
|
155
|
+
Enabled: false
|
156
|
+
|
157
|
+
# Offense count: 2
|
158
|
+
Style/DoubleNegation:
|
159
|
+
Exclude:
|
160
|
+
- 'lib/geokit/geocoders/free_geo_ip.rb'
|
161
|
+
- 'lib/geokit/geocoders/geo_plugin.rb'
|
162
|
+
|
163
|
+
# Offense count: 2
|
164
|
+
# Cop supports --auto-correct.
|
165
|
+
# Configuration parameters: AllowAdjacentOneLineDefs.
|
166
|
+
Style/EmptyLineBetweenDefs:
|
167
|
+
Exclude:
|
168
|
+
- 'lib/geokit/geocoders.rb'
|
169
|
+
- 'lib/geokit/geocoders/opencage.rb'
|
170
|
+
|
171
|
+
# Offense count: 1
|
172
|
+
# Cop supports --auto-correct.
|
173
|
+
Style/EmptyLines:
|
174
|
+
Exclude:
|
175
|
+
- 'test/test_google_geocoder.rb'
|
176
|
+
|
177
|
+
# Offense count: 15
|
178
|
+
# Cop supports --auto-correct.
|
179
|
+
# Configuration parameters: AllowForAlignment, ForceEqualSignAlignment.
|
180
|
+
Style/ExtraSpacing:
|
181
|
+
Exclude:
|
182
|
+
- 'lib/geokit/geocoders/bing.rb'
|
183
|
+
- 'lib/geokit/geocoders/yahoo.rb'
|
184
|
+
- 'test/test_mappable.rb'
|
185
|
+
- 'test/test_opencage_geocoder.rb'
|
186
|
+
- 'test/test_us_geocoder.rb'
|
187
|
+
|
188
|
+
# Offense count: 1
|
189
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
190
|
+
# SupportedStyles: format, sprintf, percent
|
191
|
+
Style/FormatString:
|
192
|
+
Exclude:
|
193
|
+
- 'test/coverage_loader.rb'
|
194
|
+
|
195
|
+
# Offense count: 1
|
196
|
+
Style/IfInsideElse:
|
197
|
+
Exclude:
|
198
|
+
- 'lib/geokit/multi_geocoder.rb'
|
199
|
+
|
200
|
+
# Offense count: 11
|
201
|
+
# Cop supports --auto-correct.
|
202
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
203
|
+
# SupportedStyles: normal, rails
|
204
|
+
Style/IndentationConsistency:
|
205
|
+
Exclude:
|
206
|
+
- 'test/test_google_geocoder.rb'
|
207
|
+
- 'test/test_openstreetmap_geocoder.rb'
|
208
|
+
|
209
|
+
# Offense count: 2
|
210
|
+
# Cop supports --auto-correct.
|
211
|
+
Style/Lambda:
|
212
|
+
Exclude:
|
213
|
+
- 'Rakefile'
|
214
|
+
|
215
|
+
# Offense count: 4
|
216
|
+
# Cop supports --auto-correct.
|
217
|
+
Style/MethodCallParentheses:
|
218
|
+
Exclude:
|
219
|
+
- 'test/test_maxmind_geocoder.rb'
|
220
|
+
|
221
|
+
# Offense count: 1
|
222
|
+
# Cop supports --auto-correct.
|
223
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles, IndentationWidth.
|
224
|
+
# SupportedStyles: aligned, indented
|
225
|
+
Style/MultilineOperationIndentation:
|
226
|
+
Enabled: false
|
227
|
+
|
228
|
+
# Offense count: 21
|
229
|
+
# Cop supports --auto-correct.
|
230
|
+
Style/MutableConstant:
|
231
|
+
Exclude:
|
232
|
+
- 'lib/geokit/geocoders/bing.rb'
|
233
|
+
- 'lib/geokit/geocoders/free_geo_ip.rb'
|
234
|
+
- 'lib/geokit/geocoders/geo_plugin.rb'
|
235
|
+
- 'lib/geokit/geocoders/geonames.rb'
|
236
|
+
- 'lib/geokit/geocoders/google.rb'
|
237
|
+
- 'lib/geokit/geocoders/mapbox.rb'
|
238
|
+
- 'lib/geokit/mappable.rb'
|
239
|
+
- 'lib/geokit/version.rb'
|
240
|
+
- 'test/test_ca_geocoder.rb'
|
241
|
+
- 'test/test_geo_plugin_geocoder.rb'
|
242
|
+
- 'test/test_ipgeocoder.rb'
|
243
|
+
- 'test/test_net_adapter.rb'
|
244
|
+
- 'test/test_us_geocoder.rb'
|
245
|
+
|
246
|
+
# Offense count: 10
|
247
|
+
# Cop supports --auto-correct.
|
248
|
+
Style/ParallelAssignment:
|
249
|
+
Exclude:
|
250
|
+
- 'lib/geokit/bounds.rb'
|
251
|
+
- 'test/test_google_geocoder.rb'
|
252
|
+
- 'test/test_map_quest.rb'
|
253
|
+
- 'test/test_multi_geocoder.rb'
|
254
|
+
- 'test/test_opencage_geocoder.rb'
|
255
|
+
- 'test/test_openstreetmap_geocoder.rb'
|
256
|
+
|
257
|
+
# Offense count: 1
|
258
|
+
# Configuration parameters: NamePrefix, NamePrefixBlacklist, NameWhitelist.
|
259
|
+
# NamePrefix: is_, has_, have_
|
260
|
+
# NamePrefixBlacklist: is_, has_, have_
|
261
|
+
# NameWhitelist: is_a?
|
262
|
+
Style/PredicateName:
|
263
|
+
Exclude:
|
264
|
+
- 'lib/geokit/geo_loc.rb'
|
265
|
+
|
266
|
+
# Offense count: 1
|
267
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
268
|
+
# SupportedStyles: compact, exploded
|
269
|
+
Style/RaiseArgs:
|
270
|
+
Enabled: false
|
271
|
+
|
272
|
+
# Offense count: 1
|
273
|
+
# Cop supports --auto-correct.
|
274
|
+
Style/RedundantSelf:
|
275
|
+
Exclude:
|
276
|
+
- 'lib/geokit/geocoders.rb'
|
277
|
+
|
278
|
+
# Offense count: 7
|
279
|
+
# Cop supports --auto-correct.
|
280
|
+
Style/RescueModifier:
|
281
|
+
Exclude:
|
282
|
+
- 'lib/geokit/geocoders/yandex.rb'
|
283
|
+
|
284
|
+
# Offense count: 1
|
285
|
+
# Cop supports --auto-correct.
|
286
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
287
|
+
# SupportedStyles: space, no_space
|
288
|
+
Style/SpaceAroundEqualsInParameterDefault:
|
289
|
+
Enabled: false
|
290
|
+
|
291
|
+
# Offense count: 3
|
292
|
+
# Cop supports --auto-correct.
|
293
|
+
# Configuration parameters: AllowForAlignment.
|
294
|
+
Style/SpaceAroundOperators:
|
295
|
+
Exclude:
|
296
|
+
- 'lib/geokit/geocoders/bing.rb'
|
297
|
+
- 'lib/geokit/geocoders/yahoo.rb'
|
298
|
+
|
299
|
+
# Offense count: 5
|
300
|
+
# Cop supports --auto-correct.
|
301
|
+
# Configuration parameters: AllowForAlignment.
|
302
|
+
Style/SpaceBeforeFirstArg:
|
303
|
+
Exclude:
|
304
|
+
- 'test/test_mappable.rb'
|
305
|
+
|
306
|
+
# Offense count: 34
|
307
|
+
# Cop supports --auto-correct.
|
308
|
+
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SupportedStyles.
|
309
|
+
# SupportedStyles: space, no_space
|
310
|
+
Style/SpaceInsideHashLiteralBraces:
|
311
|
+
Enabled: false
|
312
|
+
|
313
|
+
# Offense count: 2
|
314
|
+
# Cop supports --auto-correct.
|
315
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
316
|
+
# SupportedStyles: space, no_space
|
317
|
+
Style/SpaceInsideStringInterpolation:
|
318
|
+
Exclude:
|
319
|
+
- 'lib/geokit/geocoders/yahoo.rb'
|
320
|
+
|
321
|
+
# Offense count: 4
|
322
|
+
# Cop supports --auto-correct.
|
323
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
324
|
+
# SupportedStyles: use_perl_names, use_english_names
|
325
|
+
Style/SpecialGlobalVars:
|
326
|
+
Enabled: false
|
327
|
+
|
328
|
+
# Offense count: 3
|
329
|
+
# Cop supports --auto-correct.
|
330
|
+
# Configuration parameters: EnforcedStyleForMultiline, SupportedStyles.
|
331
|
+
# SupportedStyles: comma, consistent_comma, no_comma
|
332
|
+
Style/TrailingCommaInArguments:
|
333
|
+
Exclude:
|
334
|
+
- 'lib/geokit/geocoders/openstreetmap.rb'
|
335
|
+
- 'test/test_google_geocoder.rb'
|
336
|
+
- 'test/test_latlng.rb'
|
337
|
+
|
338
|
+
# Offense count: 12
|
339
|
+
# Cop supports --auto-correct.
|
340
|
+
# Configuration parameters: EnforcedStyleForMultiline, SupportedStyles.
|
341
|
+
# SupportedStyles: comma, consistent_comma, no_comma
|
342
|
+
Style/TrailingCommaInLiteral:
|
343
|
+
Exclude:
|
344
|
+
- 'lib/geokit/geo_loc.rb'
|
345
|
+
- 'lib/geokit/geocoders/bing.rb'
|
346
|
+
- 'lib/geokit/geocoders/free_geo_ip.rb'
|
347
|
+
- 'lib/geokit/geocoders/geo_plugin.rb'
|
348
|
+
- 'lib/geokit/geocoders/geocodio.rb'
|
349
|
+
- 'lib/geokit/geocoders/geonames.rb'
|
350
|
+
- 'lib/geokit/geocoders/google.rb'
|
351
|
+
- 'lib/geokit/geocoders/yahoo.rb'
|
352
|
+
- 'test/test_ipgeocoder.rb'
|
353
|
+
|
354
|
+
# Offense count: 6
|
355
|
+
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
356
|
+
# SupportedStyles: snake_case, camelCase
|
357
|
+
Style/VariableName:
|
358
|
+
Enabled: false
|
data/.travis.yml
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
|
-
- 1.9.3
|
4
3
|
- 2.0
|
5
4
|
- 2.1
|
6
5
|
- 2.2
|
7
|
-
|
8
|
-
|
9
|
-
- gem install bundler
|
6
|
+
- 2.3.0
|
7
|
+
script: "bundle exec rake test"
|
10
8
|
notifications:
|
11
9
|
email:
|
12
10
|
- michael+geokit@noack.com.au
|
11
|
+
sudo: false
|
12
|
+
cache: bundler
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,19 @@
|
|
1
|
+
## 1.11.0
|
2
|
+
|
3
|
+
**Existing Geocoder Changes**
|
4
|
+
* Google - Add components option
|
5
|
+
* Google - Add zip code handling
|
6
|
+
* Google - optional reverse parameters
|
7
|
+
* Bing - Provice is actually district (county)
|
8
|
+
* Mapbox - Handle state only values
|
9
|
+
* Yandex - Fetch district
|
10
|
+
* Fix multi geocoder
|
11
|
+
* Various province improvements
|
12
|
+
|
13
|
+
**Other Changes**
|
14
|
+
* Alias province to city
|
15
|
+
* Use Timeout::Error instead of TimeoutError
|
16
|
+
|
1
17
|
## 1.10.0
|
2
18
|
|
3
19
|
**Existing Geocoder Changes**
|
data/Gemfile
CHANGED
@@ -1,7 +1,7 @@
|
|
1
|
-
source
|
1
|
+
source 'https://rubygems.org'
|
2
2
|
|
3
3
|
# Specify your gem's dependencies in geokit.gemspec
|
4
4
|
gemspec
|
5
5
|
|
6
|
-
gem
|
7
|
-
gem
|
6
|
+
gem 'geoip' # for testing - only required for max_mind
|
7
|
+
gem 'pry', platforms: :ruby
|
data/README.markdown
CHANGED
@@ -45,13 +45,14 @@ Combine this gem with the [geokit-rails](http://github.com/geokit/geokit-rails)
|
|
45
45
|
* Yandex
|
46
46
|
* MapQuest
|
47
47
|
* Geocod.io
|
48
|
+
* OpenStreetMap (Nominatim)
|
48
49
|
* Mapbox - requires an access token
|
49
50
|
* [OpenCage](http://geocoder.opencagedata.com) - requires an API key
|
50
51
|
|
51
52
|
### address geocoders that also provide reverse geocoding
|
52
53
|
* Google - Supports multiple results and bounding box/country code biasing. Also supports Maps API for Business keys; see the configuration section below.
|
53
54
|
* FCC
|
54
|
-
* OpenStreetMap
|
55
|
+
* OpenStreetMap (Nominatim)
|
55
56
|
* Mapbox
|
56
57
|
* OpenCage
|
57
58
|
|
@@ -121,6 +122,10 @@ If you're using this gem by itself, here are the configuration options:
|
|
121
122
|
# and password can be provided as well.
|
122
123
|
Geokit::Geocoders::proxy = 'https://user:password@host:port'
|
123
124
|
|
125
|
+
# This setting can be used if a web service blocks requests by certain user agents.
|
126
|
+
# If not set Geokit uses the default useragent header set by the different net adapter libs.
|
127
|
+
Geokit::Geocoders::useragent = 'my agent string'
|
128
|
+
|
124
129
|
# This is your yahoo application key for the Yahoo Geocoder.
|
125
130
|
# See http://developer.yahoo.com/faq/index.html#appid
|
126
131
|
# and http://developer.yahoo.com/maps/rest/V1/geocode.html
|
@@ -221,7 +226,7 @@ In addition, you can use viewport or country code biasing to make sure the geoco
|
|
221
226
|
=> "Toledo, OH, USA"
|
222
227
|
```
|
223
228
|
|
224
|
-
Not exactly what we were looking for. We know that Toledo is in Spain, so we can tell the Google Geocoder to prefer results from Spain first, and then wander the Toledos of the world. To do that, we have to pass
|
229
|
+
Not exactly what we were looking for. We know that Toledo is in Spain, so we can tell the Google Geocoder to prefer results from Spain first, and then wander the Toledos of the world. To do that, we have to pass Spain's ccTLD (country code top-level domain) to the `:bias` option of the `geocode` method. You can find a comprehensive list of all ccTLDs here: http://en.wikipedia.org/wiki/CcTLD.
|
225
230
|
|
226
231
|
```ruby
|
227
232
|
irb> res = Geokit::Geocoders::GoogleGeocoder.geocode('Toledo', :bias => 'es')
|
@@ -246,6 +251,15 @@ Not it. What we can do is tell the geocoder to return results only from in and a
|
|
246
251
|
=> "Winnetka, California, USA"
|
247
252
|
```
|
248
253
|
|
254
|
+
Another option is to use Component Filtering as described at https://developers.google.com/maps/documentation/geocoding/intro#ComponentFiltering. To do that supply the `:components` option to the `geocode` method. This option should be a hash with keys corresponding to desired component names.
|
255
|
+
|
256
|
+
Suppose we'd like to geocode string 'Austin'. Regularly, Google would return 'Austin, TX, USA' for such a query. Not with component filtering:
|
257
|
+
|
258
|
+
```ruby
|
259
|
+
irb>res = Geokit::Geocoders::GoogleGeocoder.geocode("austin", components: { administrative_area: 'IL', country: 'US' })
|
260
|
+
irb>res.full_address
|
261
|
+
=> "Austin, Chicago, IL, USA"
|
262
|
+
```
|
249
263
|
|
250
264
|
### The Multigeocoder
|
251
265
|
Multi Geocoder - provides failover for the physical location geocoders, and also IP address geocoders. Its configured by setting Geokit::Geocoders::provider_order, and Geokit::Geocoders::ip_provider_order. You should call the Multi-Geocoder with its :geocode method, supplying one address parameter which is either a real street address, or an ip address. For example:
|
@@ -254,12 +268,13 @@ Multi Geocoder - provides failover for the physical location geocoders, and also
|
|
254
268
|
Geokit::Geocoders::MultiGeocoder.geocode("900 Sycamore Drive")
|
255
269
|
|
256
270
|
Geokit::Geocoders::MultiGeocoder.geocode("12.12.12.12")
|
271
|
+
|
272
|
+
Geokit::Geocoders::MultiGeocoder.geocode("Hamburg, Germany", :provider_order => [:osm, :mapbox, :google])
|
257
273
|
```
|
258
274
|
|
259
275
|
## MULTIPLE RESULTS
|
260
276
|
Some geocoding services will return multple results if the there isn't one clear result.
|
261
|
-
Geoloc can capture multiple results through its "all" method.
|
262
|
-
supports multiple results:
|
277
|
+
Geoloc can capture multiple results through its "all" method.
|
263
278
|
|
264
279
|
```ruby
|
265
280
|
irb> geo=Geokit::Geocoders::GoogleGeocoder.geocode("900 Sycamore Drive")
|