geokit 1.8.5 → 1.9.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +7 -0
  2. data/.travis.yml +0 -1
  3. data/CHANGELOG.md +7 -0
  4. data/README.markdown +31 -14
  5. data/fixtures/vcr_cassettes/geonames_geocode.yml +1 -1
  6. data/fixtures/vcr_cassettes/geonames_geocode_premium.yml +42 -0
  7. data/fixtures/vcr_cassettes/google_country_code_biased_result_orly.yml +160 -0
  8. data/fixtures/vcr_cassettes/google_country_code_biased_result_toledo.yml +111 -0
  9. data/fixtures/vcr_cassettes/google_result_toledo_default_bias.yml +275 -0
  10. data/fixtures/vcr_cassettes/google_sublocality.yml +126 -0
  11. data/fixtures/vcr_cassettes/mapbox_forward_geocode.yml +59 -0
  12. data/fixtures/vcr_cassettes/mapbox_reverse_geocode.yml +63 -0
  13. data/fixtures/vcr_cassettes/opencage_city.yml +51 -0
  14. data/fixtures/vcr_cassettes/opencage_full.yml +65 -0
  15. data/fixtures/vcr_cassettes/opencage_language_response_es.yml +66 -0
  16. data/fixtures/vcr_cassettes/opencage_reverse_madrid.yml +51 -0
  17. data/fixtures/vcr_cassettes/opencage_reverse_prilep.yml +53 -0
  18. data/geokit.gemspec +5 -3
  19. data/lib/geokit/bounds.rb +40 -31
  20. data/lib/geokit/core_ext.rb +1 -1
  21. data/lib/geokit/geo_loc.rb +63 -41
  22. data/lib/geokit/geocoders.rb +13 -13
  23. data/lib/geokit/geocoders/bing.rb +9 -9
  24. data/lib/geokit/geocoders/ca_geocoder.rb +29 -29
  25. data/lib/geokit/geocoders/fcc.rb +4 -4
  26. data/lib/geokit/geocoders/free_geo_ip.rb +6 -7
  27. data/lib/geokit/geocoders/geo_plugin.rb +5 -6
  28. data/lib/geokit/geocoders/geocodio.rb +2 -2
  29. data/lib/geokit/geocoders/geonames.rb +18 -12
  30. data/lib/geokit/geocoders/google.rb +31 -30
  31. data/lib/geokit/geocoders/ip.rb +3 -4
  32. data/lib/geokit/geocoders/mapbox.rb +94 -0
  33. data/lib/geokit/geocoders/mapquest.rb +5 -5
  34. data/lib/geokit/geocoders/opencage.rb +93 -0
  35. data/lib/geokit/geocoders/openstreetmap.rb +9 -6
  36. data/lib/geokit/geocoders/ripe.rb +3 -3
  37. data/lib/geokit/geocoders/us_geocoder.rb +10 -9
  38. data/lib/geokit/geocoders/yahoo.rb +33 -34
  39. data/lib/geokit/geocoders/yandex.rb +17 -17
  40. data/lib/geokit/inflectors.rb +4 -10
  41. data/lib/geokit/lat_lng.rb +50 -26
  42. data/lib/geokit/mappable.rb +83 -83
  43. data/lib/geokit/multi_geocoder.rb +25 -20
  44. data/lib/geokit/net_adapter/net_http.rb +7 -4
  45. data/lib/geokit/polygon.rb +36 -4
  46. data/lib/geokit/version.rb +1 -1
  47. data/test/helper.rb +15 -13
  48. data/test/test_base_geocoder.rb +6 -7
  49. data/test/test_bing_geocoder.rb +20 -21
  50. data/test/test_bounds.rb +26 -28
  51. data/test/test_ca_geocoder.rb +9 -10
  52. data/test/test_fcc_geocoder.rb +1 -1
  53. data/test/test_free_geo_ip_geocoder.rb +1 -1
  54. data/test/test_geo_plugin_geocoder.rb +9 -9
  55. data/test/test_geoloc.rb +7 -6
  56. data/test/test_geonames_geocoder.rb +28 -6
  57. data/test/test_google_geocoder.rb +210 -176
  58. data/test/test_inflector.rb +0 -1
  59. data/test/test_ipgeocoder.rb +17 -18
  60. data/test/test_latlng.rb +105 -85
  61. data/test/test_map_quest.rb +18 -21
  62. data/test/test_mapbox_geocoder.rb +31 -0
  63. data/test/test_mappable.rb +46 -0
  64. data/test/test_maxmind_geocoder.rb +1 -3
  65. data/test/test_multi_geocoder.rb +8 -9
  66. data/test/test_multi_ip_geocoder.rb +3 -5
  67. data/test/test_net_adapter.rb +4 -4
  68. data/test/test_opencage_geocoder.rb +108 -0
  69. data/test/test_openstreetmap_geocoder.rb +62 -44
  70. data/test/{test_polygon_contains.rb → test_polygon.rb} +30 -20
  71. data/test/test_ripe_geocoder.rb +2 -0
  72. data/test/test_us_geocoder.rb +7 -8
  73. data/test/test_yahoo_geocoder.rb +20 -21
  74. data/test/test_yandex_geocoder.rb +34 -35
  75. metadata +79 -56
  76. data/fixtures/vcr_cassettes/google_country_code_biased_result.yml +0 -401
@@ -1,401 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: get
5
- uri: https://maps.google.com/maps/api/geocode/json?address=Syracuse&region=it&sensor=false
6
- body:
7
- encoding: US-ASCII
8
- string: ''
9
- headers:
10
- Accept-Encoding:
11
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
- Accept:
13
- - '*/*'
14
- User-Agent:
15
- - Ruby
16
- response:
17
- status:
18
- code: 200
19
- message: OK
20
- headers:
21
- Content-Type:
22
- - application/json; charset=UTF-8
23
- Date:
24
- - Sun, 26 Jan 2014 05:46:38 GMT
25
- Expires:
26
- - Mon, 27 Jan 2014 05:46:38 GMT
27
- Cache-Control:
28
- - public, max-age=86400
29
- Vary:
30
- - Accept-Language
31
- Access-Control-Allow-Origin:
32
- - '*'
33
- Server:
34
- - mafe
35
- X-Xss-Protection:
36
- - 1; mode=block
37
- X-Frame-Options:
38
- - SAMEORIGIN
39
- Alternate-Protocol:
40
- - 443:quic
41
- Transfer-Encoding:
42
- - chunked
43
- body:
44
- encoding: UTF-8
45
- string: |
46
- {
47
- "results" : [
48
- {
49
- "address_components" : [
50
- {
51
- "long_name" : "Syracuse",
52
- "short_name" : "Syracuse",
53
- "types" : [ "locality", "political" ]
54
- },
55
- {
56
- "long_name" : "Onondaga",
57
- "short_name" : "Onondaga",
58
- "types" : [ "administrative_area_level_2", "political" ]
59
- },
60
- {
61
- "long_name" : "New York",
62
- "short_name" : "NY",
63
- "types" : [ "administrative_area_level_1", "political" ]
64
- },
65
- {
66
- "long_name" : "United States",
67
- "short_name" : "US",
68
- "types" : [ "country", "political" ]
69
- }
70
- ],
71
- "formatted_address" : "Syracuse, NY, USA",
72
- "geometry" : {
73
- "bounds" : {
74
- "northeast" : {
75
- "lat" : 43.0861019,
76
- "lng" : -76.074084
77
- },
78
- "southwest" : {
79
- "lat" : 42.984366,
80
- "lng" : -76.20447600000001
81
- }
82
- },
83
- "location" : {
84
- "lat" : 43.0481221,
85
- "lng" : -76.14742439999999
86
- },
87
- "location_type" : "APPROXIMATE",
88
- "viewport" : {
89
- "northeast" : {
90
- "lat" : 43.0861019,
91
- "lng" : -76.074084
92
- },
93
- "southwest" : {
94
- "lat" : 42.984366,
95
- "lng" : -76.20447600000001
96
- }
97
- }
98
- },
99
- "types" : [ "locality", "political" ]
100
- },
101
- {
102
- "address_components" : [
103
- {
104
- "long_name" : "Syracuse",
105
- "short_name" : "Syracuse",
106
- "types" : [ "locality", "political" ]
107
- },
108
- {
109
- "long_name" : "Turkey Creek",
110
- "short_name" : "Turkey Creek",
111
- "types" : [ "administrative_area_level_3", "political" ]
112
- },
113
- {
114
- "long_name" : "Kosciusko",
115
- "short_name" : "Kosciusko",
116
- "types" : [ "administrative_area_level_2", "political" ]
117
- },
118
- {
119
- "long_name" : "Indiana",
120
- "short_name" : "IN",
121
- "types" : [ "administrative_area_level_1", "political" ]
122
- },
123
- {
124
- "long_name" : "United States",
125
- "short_name" : "US",
126
- "types" : [ "country", "political" ]
127
- },
128
- {
129
- "long_name" : "46567",
130
- "short_name" : "46567",
131
- "types" : [ "postal_code" ]
132
- }
133
- ],
134
- "formatted_address" : "Syracuse, IN 46567, USA",
135
- "geometry" : {
136
- "bounds" : {
137
- "northeast" : {
138
- "lat" : 41.43607,
139
- "lng" : -85.73427170000001
140
- },
141
- "southwest" : {
142
- "lat" : 41.403028,
143
- "lng" : -85.7686119
144
- }
145
- },
146
- "location" : {
147
- "lat" : 41.42782570000001,
148
- "lng" : -85.7524895
149
- },
150
- "location_type" : "APPROXIMATE",
151
- "viewport" : {
152
- "northeast" : {
153
- "lat" : 41.43607,
154
- "lng" : -85.73427170000001
155
- },
156
- "southwest" : {
157
- "lat" : 41.403028,
158
- "lng" : -85.7686119
159
- }
160
- }
161
- },
162
- "types" : [ "locality", "political" ]
163
- },
164
- {
165
- "address_components" : [
166
- {
167
- "long_name" : "Syracuse",
168
- "short_name" : "Syracuse",
169
- "types" : [ "locality", "political" ]
170
- },
171
- {
172
- "long_name" : "Davis County",
173
- "short_name" : "Davis County",
174
- "types" : [ "administrative_area_level_2", "political" ]
175
- },
176
- {
177
- "long_name" : "Utah",
178
- "short_name" : "UT",
179
- "types" : [ "administrative_area_level_1", "political" ]
180
- },
181
- {
182
- "long_name" : "United States",
183
- "short_name" : "US",
184
- "types" : [ "country", "political" ]
185
- }
186
- ],
187
- "formatted_address" : "Syracuse, UT, USA",
188
- "geometry" : {
189
- "bounds" : {
190
- "northeast" : {
191
- "lat" : 41.111047,
192
- "lng" : -112.035575
193
- },
194
- "southwest" : {
195
- "lat" : 41.0556259,
196
- "lng" : -112.117135
197
- }
198
- },
199
- "location" : {
200
- "lat" : 41.0893878,
201
- "lng" : -112.0646657
202
- },
203
- "location_type" : "APPROXIMATE",
204
- "viewport" : {
205
- "northeast" : {
206
- "lat" : 41.111047,
207
- "lng" : -112.035575
208
- },
209
- "southwest" : {
210
- "lat" : 41.0556259,
211
- "lng" : -112.117135
212
- }
213
- }
214
- },
215
- "types" : [ "locality", "political" ]
216
- },
217
- {
218
- "address_components" : [
219
- {
220
- "long_name" : "Syracuse",
221
- "short_name" : "Syracuse",
222
- "types" : [ "locality", "political" ]
223
- },
224
- {
225
- "long_name" : "Syracuse",
226
- "short_name" : "Syracuse",
227
- "types" : [ "administrative_area_level_3", "political" ]
228
- },
229
- {
230
- "long_name" : "Hamilton",
231
- "short_name" : "Hamilton",
232
- "types" : [ "administrative_area_level_2", "political" ]
233
- },
234
- {
235
- "long_name" : "Kansas",
236
- "short_name" : "KS",
237
- "types" : [ "administrative_area_level_1", "political" ]
238
- },
239
- {
240
- "long_name" : "United States",
241
- "short_name" : "US",
242
- "types" : [ "country", "political" ]
243
- }
244
- ],
245
- "formatted_address" : "Syracuse, KS, USA",
246
- "geometry" : {
247
- "bounds" : {
248
- "northeast" : {
249
- "lat" : 37.9904949,
250
- "lng" : -101.7367079
251
- },
252
- "southwest" : {
253
- "lat" : 37.968298,
254
- "lng" : -101.762123
255
- }
256
- },
257
- "location" : {
258
- "lat" : 37.9805686,
259
- "lng" : -101.7526718
260
- },
261
- "location_type" : "APPROXIMATE",
262
- "viewport" : {
263
- "northeast" : {
264
- "lat" : 37.9904949,
265
- "lng" : -101.7367079
266
- },
267
- "southwest" : {
268
- "lat" : 37.968298,
269
- "lng" : -101.762123
270
- }
271
- }
272
- },
273
- "types" : [ "locality", "political" ]
274
- },
275
- {
276
- "address_components" : [
277
- {
278
- "long_name" : "Syracuse",
279
- "short_name" : "Syracuse",
280
- "types" : [ "locality", "political" ]
281
- },
282
- {
283
- "long_name" : "Syracuse",
284
- "short_name" : "Syracuse",
285
- "types" : [ "administrative_area_level_3", "political" ]
286
- },
287
- {
288
- "long_name" : "Otoe",
289
- "short_name" : "Otoe",
290
- "types" : [ "administrative_area_level_2", "political" ]
291
- },
292
- {
293
- "long_name" : "Nebraska",
294
- "short_name" : "NE",
295
- "types" : [ "administrative_area_level_1", "political" ]
296
- },
297
- {
298
- "long_name" : "United States",
299
- "short_name" : "US",
300
- "types" : [ "country", "political" ]
301
- },
302
- {
303
- "long_name" : "68446",
304
- "short_name" : "68446",
305
- "types" : [ "postal_code" ]
306
- }
307
- ],
308
- "formatted_address" : "Syracuse, NE 68446, USA",
309
- "geometry" : {
310
- "bounds" : {
311
- "northeast" : {
312
- "lat" : 40.672865,
313
- "lng" : -96.172004
314
- },
315
- "southwest" : {
316
- "lat" : 40.6512059,
317
- "lng" : -96.1978209
318
- }
319
- },
320
- "location" : {
321
- "lat" : 40.6601895,
322
- "lng" : -96.18248349999999
323
- },
324
- "location_type" : "APPROXIMATE",
325
- "viewport" : {
326
- "northeast" : {
327
- "lat" : 40.672865,
328
- "lng" : -96.172004
329
- },
330
- "southwest" : {
331
- "lat" : 40.6512059,
332
- "lng" : -96.1978209
333
- }
334
- }
335
- },
336
- "types" : [ "locality", "political" ]
337
- },
338
- {
339
- "address_components" : [
340
- {
341
- "long_name" : "Syracuse",
342
- "short_name" : "Syracuse",
343
- "types" : [ "locality", "political" ]
344
- },
345
- {
346
- "long_name" : "Siracusa",
347
- "short_name" : "Siracusa",
348
- "types" : [ "administrative_area_level_3", "political" ]
349
- },
350
- {
351
- "long_name" : "Syracuse",
352
- "short_name" : "SR",
353
- "types" : [ "administrative_area_level_2", "political" ]
354
- },
355
- {
356
- "long_name" : "Sicilia",
357
- "short_name" : "Sicilia",
358
- "types" : [ "administrative_area_level_1", "political" ]
359
- },
360
- {
361
- "long_name" : "Italy",
362
- "short_name" : "IT",
363
- "types" : [ "country", "political" ]
364
- }
365
- ],
366
- "formatted_address" : "Syracuse, Italy",
367
- "geometry" : {
368
- "bounds" : {
369
- "northeast" : {
370
- "lat" : 37.105663,
371
- "lng" : 15.3012623
372
- },
373
- "southwest" : {
374
- "lat" : 37.0526519,
375
- "lng" : 15.2405306
376
- }
377
- },
378
- "location" : {
379
- "lat" : 37.0754739,
380
- "lng" : 15.2865861
381
- },
382
- "location_type" : "APPROXIMATE",
383
- "viewport" : {
384
- "northeast" : {
385
- "lat" : 37.105663,
386
- "lng" : 15.3012623
387
- },
388
- "southwest" : {
389
- "lat" : 37.0526519,
390
- "lng" : 15.2405306
391
- }
392
- }
393
- },
394
- "types" : [ "locality", "political" ]
395
- }
396
- ],
397
- "status" : "OK"
398
- }
399
- http_version:
400
- recorded_at: Sun, 26 Jan 2014 05:46:38 GMT
401
- recorded_with: VCR 2.8.0