geocoder2 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +5 -0
- data/.travis.yml +27 -0
- data/CHANGELOG.md +329 -0
- data/LICENSE +20 -0
- data/README.md +796 -0
- data/Rakefile +25 -0
- data/bin/geocode2 +5 -0
- data/examples/autoexpire_cache_dalli.rb +62 -0
- data/examples/autoexpire_cache_redis.rb +28 -0
- data/examples/cache_bypass.rb +48 -0
- data/gemfiles/Gemfile.mongoid-2.4.x +15 -0
- data/json?address=26+leonard+street%2C+Belmont&key=AIzaSyDoltU6YL8XeIQrSLFGk6ZfpKaWkPukwYQ&language=en +68 -0
- data/lib/generators/geocoder2/config/config_generator.rb +14 -0
- data/lib/generators/geocoder2/config/templates/initializer.rb +21 -0
- data/lib/geocoder2/cache.rb +89 -0
- data/lib/geocoder2/calculations.rb +389 -0
- data/lib/geocoder2/cli.rb +121 -0
- data/lib/geocoder2/configuration.rb +130 -0
- data/lib/geocoder2/configuration_hash.rb +11 -0
- data/lib/geocoder2/exceptions.rb +21 -0
- data/lib/geocoder2/lookup.rb +86 -0
- data/lib/geocoder2/lookups/baidu.rb +54 -0
- data/lib/geocoder2/lookups/base.rb +266 -0
- data/lib/geocoder2/lookups/bing.rb +47 -0
- data/lib/geocoder2/lookups/dstk.rb +20 -0
- data/lib/geocoder2/lookups/esri.rb +48 -0
- data/lib/geocoder2/lookups/freegeoip.rb +43 -0
- data/lib/geocoder2/lookups/geocoder_ca.rb +54 -0
- data/lib/geocoder2/lookups/geocoder_us.rb +39 -0
- data/lib/geocoder2/lookups/google.rb +69 -0
- data/lib/geocoder2/lookups/google_premier.rb +47 -0
- data/lib/geocoder2/lookups/mapquest.rb +59 -0
- data/lib/geocoder2/lookups/maxmind.rb +88 -0
- data/lib/geocoder2/lookups/nominatim.rb +44 -0
- data/lib/geocoder2/lookups/ovi.rb +62 -0
- data/lib/geocoder2/lookups/test.rb +44 -0
- data/lib/geocoder2/lookups/yahoo.rb +86 -0
- data/lib/geocoder2/lookups/yandex.rb +54 -0
- data/lib/geocoder2/models/active_record.rb +46 -0
- data/lib/geocoder2/models/base.rb +42 -0
- data/lib/geocoder2/models/mongo_base.rb +60 -0
- data/lib/geocoder2/models/mongo_mapper.rb +26 -0
- data/lib/geocoder2/models/mongoid.rb +32 -0
- data/lib/geocoder2/query.rb +107 -0
- data/lib/geocoder2/railtie.rb +26 -0
- data/lib/geocoder2/request.rb +23 -0
- data/lib/geocoder2/results/baidu.rb +79 -0
- data/lib/geocoder2/results/base.rb +67 -0
- data/lib/geocoder2/results/bing.rb +48 -0
- data/lib/geocoder2/results/dstk.rb +6 -0
- data/lib/geocoder2/results/esri.rb +51 -0
- data/lib/geocoder2/results/freegeoip.rb +45 -0
- data/lib/geocoder2/results/geocoder_ca.rb +60 -0
- data/lib/geocoder2/results/geocoder_us.rb +39 -0
- data/lib/geocoder2/results/google.rb +124 -0
- data/lib/geocoder2/results/google_premier.rb +6 -0
- data/lib/geocoder2/results/mapquest.rb +51 -0
- data/lib/geocoder2/results/maxmind.rb +135 -0
- data/lib/geocoder2/results/nominatim.rb +94 -0
- data/lib/geocoder2/results/ovi.rb +62 -0
- data/lib/geocoder2/results/test.rb +16 -0
- data/lib/geocoder2/results/yahoo.rb +55 -0
- data/lib/geocoder2/results/yandex.rb +80 -0
- data/lib/geocoder2/sql.rb +106 -0
- data/lib/geocoder2/stores/active_record.rb +272 -0
- data/lib/geocoder2/stores/base.rb +120 -0
- data/lib/geocoder2/stores/mongo_base.rb +89 -0
- data/lib/geocoder2/stores/mongo_mapper.rb +13 -0
- data/lib/geocoder2/stores/mongoid.rb +13 -0
- data/lib/geocoder2/version.rb +3 -0
- data/lib/geocoder2.rb +55 -0
- data/lib/hash_recursive_merge.rb +74 -0
- data/lib/oauth_util.rb +112 -0
- data/lib/tasks/geocoder2.rake +27 -0
- data/test/active_record_test.rb +15 -0
- data/test/cache_test.rb +35 -0
- data/test/calculations_test.rb +211 -0
- data/test/configuration_test.rb +78 -0
- data/test/custom_block_test.rb +32 -0
- data/test/error_handling_test.rb +43 -0
- data/test/fixtures/baidu_invalid_key +1 -0
- data/test/fixtures/baidu_no_results +1 -0
- data/test/fixtures/baidu_reverse +1 -0
- data/test/fixtures/baidu_shanghai_pearl_tower +12 -0
- data/test/fixtures/bing_invalid_key +1 -0
- data/test/fixtures/bing_madison_square_garden +40 -0
- data/test/fixtures/bing_no_results +16 -0
- data/test/fixtures/bing_reverse +42 -0
- data/test/fixtures/esri_madison_square_garden +59 -0
- data/test/fixtures/esri_no_results +8 -0
- data/test/fixtures/esri_reverse +21 -0
- data/test/fixtures/freegeoip_74_200_247_59 +12 -0
- data/test/fixtures/freegeoip_no_results +1 -0
- data/test/fixtures/geocoder_ca_madison_square_garden +1 -0
- data/test/fixtures/geocoder_ca_no_results +1 -0
- data/test/fixtures/geocoder_ca_reverse +34 -0
- data/test/fixtures/geocoder_us_madison_square_garden +1 -0
- data/test/fixtures/geocoder_us_no_results +1 -0
- data/test/fixtures/google_garbage +456 -0
- data/test/fixtures/google_madison_square_garden +57 -0
- data/test/fixtures/google_no_city_data +44 -0
- data/test/fixtures/google_no_locality +51 -0
- data/test/fixtures/google_no_results +4 -0
- data/test/fixtures/google_over_limit +4 -0
- data/test/fixtures/mapquest_error +16 -0
- data/test/fixtures/mapquest_invalid_api_key +16 -0
- data/test/fixtures/mapquest_invalid_request +16 -0
- data/test/fixtures/mapquest_madison_square_garden +52 -0
- data/test/fixtures/mapquest_no_results +16 -0
- data/test/fixtures/maxmind_24_24_24_21 +1 -0
- data/test/fixtures/maxmind_24_24_24_22 +1 -0
- data/test/fixtures/maxmind_24_24_24_23 +1 -0
- data/test/fixtures/maxmind_24_24_24_24 +1 -0
- data/test/fixtures/maxmind_74_200_247_59 +1 -0
- data/test/fixtures/maxmind_invalid_key +1 -0
- data/test/fixtures/maxmind_no_results +1 -0
- data/test/fixtures/nominatim_madison_square_garden +150 -0
- data/test/fixtures/nominatim_no_results +1 -0
- data/test/fixtures/ovi_madison_square_garden +72 -0
- data/test/fixtures/ovi_no_results +8 -0
- data/test/fixtures/yahoo_error +1 -0
- data/test/fixtures/yahoo_invalid_key +2 -0
- data/test/fixtures/yahoo_madison_square_garden +52 -0
- data/test/fixtures/yahoo_no_results +10 -0
- data/test/fixtures/yahoo_over_limit +2 -0
- data/test/fixtures/yandex_invalid_key +1 -0
- data/test/fixtures/yandex_kremlin +48 -0
- data/test/fixtures/yandex_no_city_and_town +112 -0
- data/test/fixtures/yandex_no_results +16 -0
- data/test/geocoder_test.rb +59 -0
- data/test/https_test.rb +16 -0
- data/test/integration/smoke_test.rb +26 -0
- data/test/lookup_test.rb +117 -0
- data/test/method_aliases_test.rb +25 -0
- data/test/mongoid_test.rb +46 -0
- data/test/mongoid_test_helper.rb +43 -0
- data/test/near_test.rb +61 -0
- data/test/oauth_util_test.rb +30 -0
- data/test/proxy_test.rb +36 -0
- data/test/query_test.rb +52 -0
- data/test/request_test.rb +29 -0
- data/test/result_test.rb +42 -0
- data/test/services_test.rb +393 -0
- data/test/test_helper.rb +289 -0
- data/test/test_mode_test.rb +59 -0
- metadata +213 -0
@@ -0,0 +1,40 @@
|
|
1
|
+
{
|
2
|
+
"authenticationResultCode":"ValidCredentials",
|
3
|
+
"brandLogoUri":"http:\/\/dev.virtualearth.net\/Branding\/logo_powered_by.png",
|
4
|
+
"copyright":"Copyright © 2011 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.",
|
5
|
+
"resourceSets":[
|
6
|
+
{
|
7
|
+
"estimatedTotal":1,
|
8
|
+
"resources":[
|
9
|
+
{
|
10
|
+
"__type":"Location:http:\/\/schemas.microsoft.com\/search\/local\/ws\/rest\/v1",
|
11
|
+
"bbox":[
|
12
|
+
40.744944289326668,
|
13
|
+
-74.002353921532631,
|
14
|
+
40.755675807595253,
|
15
|
+
-73.983625397086143
|
16
|
+
],
|
17
|
+
"name":"Madison Square Garden, NY",
|
18
|
+
"point":{
|
19
|
+
"type":"Point",
|
20
|
+
"coordinates":[
|
21
|
+
40.75031,
|
22
|
+
-73.99299
|
23
|
+
]
|
24
|
+
},
|
25
|
+
"address":{
|
26
|
+
"adminDistrict":"NY",
|
27
|
+
"countryRegion":"United States",
|
28
|
+
"formattedAddress":"Madison Square Garden, NY",
|
29
|
+
"locality":"New York"
|
30
|
+
},
|
31
|
+
"confidence":"High",
|
32
|
+
"entityType":"Stadium"
|
33
|
+
}
|
34
|
+
]
|
35
|
+
}
|
36
|
+
],
|
37
|
+
"statusCode":200,
|
38
|
+
"statusDescription":"OK",
|
39
|
+
"traceId":"55094ee53c8d45e789794014666328cd|CH1M001466|02.00.82.2800|CH1MSNVM001396, CH1MSNVM001370, CH1MSNVM001397"
|
40
|
+
}
|
@@ -0,0 +1,16 @@
|
|
1
|
+
{
|
2
|
+
"authenticationResultCode":"ValidCredentials",
|
3
|
+
"brandLogoUri":"http:\/\/dev.virtualearth.net\/Branding\/logo_powered_by.png",
|
4
|
+
"copyright":"Copyright © 2011 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.",
|
5
|
+
"resourceSets":[
|
6
|
+
{
|
7
|
+
"estimatedTotal":0,
|
8
|
+
"resources":[
|
9
|
+
|
10
|
+
]
|
11
|
+
}
|
12
|
+
],
|
13
|
+
"statusCode":200,
|
14
|
+
"statusDescription":"OK",
|
15
|
+
"traceId":"907b76a307bc49129a489de3d4c992ea|CH1M001463|02.00.82.2800|CH1MSNVM001383, CH1MSNVM001358, CH1MSNVM001397"
|
16
|
+
}
|
@@ -0,0 +1,42 @@
|
|
1
|
+
{
|
2
|
+
"authenticationResultCode":"ValidCredentials",
|
3
|
+
"brandLogoUri":"http:\/\/dev.virtualearth.net\/Branding\/logo_powered_by.png",
|
4
|
+
"copyright":"Copyright © 2011 Microsoft and its suppliers. All rights reserved. This API cannot be accessed and the content and any results may not be used, reproduced or transmitted in any manner without express written permission from Microsoft Corporation.",
|
5
|
+
"resourceSets":[
|
6
|
+
{
|
7
|
+
"estimatedTotal":1,
|
8
|
+
"resources":[
|
9
|
+
{
|
10
|
+
"__type":"Location:http:\/\/schemas.microsoft.com\/search\/local\/ws\/rest\/v1",
|
11
|
+
"bbox":[
|
12
|
+
45.419835111675845,
|
13
|
+
-75.683656128790716,
|
14
|
+
45.4275605468172,
|
15
|
+
-75.66898098334994
|
16
|
+
],
|
17
|
+
"name":"291 Rue Somerset E, Ottawa, ON, K1N",
|
18
|
+
"point":{
|
19
|
+
"type":"Point",
|
20
|
+
"coordinates":[
|
21
|
+
45.423697829246521,
|
22
|
+
-75.676318556070328
|
23
|
+
]
|
24
|
+
},
|
25
|
+
"address":{
|
26
|
+
"addressLine":"291 Rue Somerset E",
|
27
|
+
"adminDistrict":"ON",
|
28
|
+
"countryRegion":"Canada",
|
29
|
+
"formattedAddress":"291 Rue Somerset E, Ottawa, ON, K1N",
|
30
|
+
"locality":"Ottawa",
|
31
|
+
"postalCode":"K1N"
|
32
|
+
},
|
33
|
+
"confidence":"Medium",
|
34
|
+
"entityType":"Address"
|
35
|
+
}
|
36
|
+
]
|
37
|
+
}
|
38
|
+
],
|
39
|
+
"statusCode":200,
|
40
|
+
"statusDescription":"OK",
|
41
|
+
"traceId":"27bd5ed659e64ba6970c4144f1d4ea94|CH1M001470|02.00.82.2800|CH1MSNVM001396, CH1MSNVM001374"
|
42
|
+
}
|
@@ -0,0 +1,59 @@
|
|
1
|
+
{
|
2
|
+
"spatialReference": {
|
3
|
+
"wkid": 4326,
|
4
|
+
"latestWkid": 4326
|
5
|
+
},
|
6
|
+
"locations": [
|
7
|
+
{
|
8
|
+
"name": "Madison Square Garden",
|
9
|
+
"extent": {
|
10
|
+
"xmin": -74.000241000000003,
|
11
|
+
"ymin": 40.744050000000001,
|
12
|
+
"xmax": -73.988241000000002,
|
13
|
+
"ymax": 40.756050000000002
|
14
|
+
},
|
15
|
+
"feature": {
|
16
|
+
"geometry": {
|
17
|
+
"x": -73.994238897999651,
|
18
|
+
"y": 40.750049813000487
|
19
|
+
},
|
20
|
+
"attributes": {
|
21
|
+
"Loc_name": "Gaz.WorldGazetteer.POI2",
|
22
|
+
"Score": 100,
|
23
|
+
"Match_addr": "Madison Square Garden",
|
24
|
+
"Addr_type": "POI",
|
25
|
+
"Type": "Sports Complex",
|
26
|
+
"PlaceName": "Madison Square Garden",
|
27
|
+
"Rank": "18",
|
28
|
+
"AddBldg": "",
|
29
|
+
"AddNum": "",
|
30
|
+
"AddNumFrom": "",
|
31
|
+
"AddNumTo": "",
|
32
|
+
"Side": "",
|
33
|
+
"StPreDir": "",
|
34
|
+
"StPreType": "",
|
35
|
+
"StName": "",
|
36
|
+
"StType": "",
|
37
|
+
"StDir": "",
|
38
|
+
"Nbrhd": "",
|
39
|
+
"City": "New York",
|
40
|
+
"Subregion": "New York",
|
41
|
+
"Region": "New York",
|
42
|
+
"Postal": "10001",
|
43
|
+
"PostalExt": "",
|
44
|
+
"Country": "USA",
|
45
|
+
"LangCode": "",
|
46
|
+
"Distance": 0,
|
47
|
+
"X": -73.994240000000005,
|
48
|
+
"Y": 40.750050000000002,
|
49
|
+
"DisplayX": -73.994240000000005,
|
50
|
+
"DisplayY": 40.750050000000002,
|
51
|
+
"Xmin": -74.000241000000003,
|
52
|
+
"Xmax": -73.988241000000002,
|
53
|
+
"Ymin": 40.744050000000001,
|
54
|
+
"Ymax": 40.756050000000002
|
55
|
+
}
|
56
|
+
}
|
57
|
+
}
|
58
|
+
]
|
59
|
+
}
|
@@ -0,0 +1,21 @@
|
|
1
|
+
{
|
2
|
+
"address": {
|
3
|
+
"Address": "4 Avenue Gustave Eiffel",
|
4
|
+
"Neighborhood": "7e Arrondissement",
|
5
|
+
"City": "Paris",
|
6
|
+
"Subregion": "Paris",
|
7
|
+
"Region": "Île-de-France",
|
8
|
+
"Postal": "75007",
|
9
|
+
"PostalExt": null,
|
10
|
+
"CountryCode": "FRA",
|
11
|
+
"Loc_name": "FRA.PointAddress"
|
12
|
+
},
|
13
|
+
"location": {
|
14
|
+
"x": 2.2956200048981574,
|
15
|
+
"y": 48.858129997357558,
|
16
|
+
"spatialReference": {
|
17
|
+
"wkid": 4326,
|
18
|
+
"latestWkid": 4326
|
19
|
+
}
|
20
|
+
}
|
21
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
<html><title>404: Not Found</title><body>404: Not Found</body></html>
|
@@ -0,0 +1 @@
|
|
1
|
+
test({"longt":"-73.992006","latt":"40.749101"});
|
@@ -0,0 +1 @@
|
|
1
|
+
test({"longt":"-0.000000","error":{"description":"Postal Code is not in the proper Format.","code":"005"},"latt":"176946676.000000"});
|
@@ -0,0 +1,34 @@
|
|
1
|
+
test({
|
2
|
+
"latt":"45.423733",
|
3
|
+
"longt":"-75.676333",
|
4
|
+
"inlatt":"45.424035",
|
5
|
+
"inlongt":"-75.675941",
|
6
|
+
"betweenRoad1":"Chapel",
|
7
|
+
"betweenRoad2":"Russell",
|
8
|
+
"distance":"0.034",
|
9
|
+
"stnumber":"289",
|
10
|
+
"staddress":"Somerset ST E",
|
11
|
+
"city":"Ottawa",
|
12
|
+
"prov":"ON",
|
13
|
+
"postal":"K1N6W1",
|
14
|
+
"NearRoad":"Somerset ST E",
|
15
|
+
"NearRoadDistance":"0.013",
|
16
|
+
"intersection":{
|
17
|
+
"lattx":"45.423733",
|
18
|
+
"longtx":"-75.676333",
|
19
|
+
"distance":"0.045",
|
20
|
+
"street1":"Somerset St E",
|
21
|
+
"street2":"Russell Ave",
|
22
|
+
"city":"OTTAWA",
|
23
|
+
"prov":"ON"
|
24
|
+
},
|
25
|
+
"major_intersection":{
|
26
|
+
"lattx":"45.4241623853",
|
27
|
+
"longtx":"-75.6753026518",
|
28
|
+
"distance":"0.052",
|
29
|
+
"street1":"Chapel St",
|
30
|
+
"street2":"Somerset St E",
|
31
|
+
"city":"OTTAWA",
|
32
|
+
"prov":"ON"
|
33
|
+
}
|
34
|
+
});
|
@@ -0,0 +1 @@
|
|
1
|
+
40.678107, -73.897460, 4 Pennsylvania Ave, New York, NY, 11207
|
@@ -0,0 +1 @@
|
|
1
|
+
2: couldn't find this address! sorry
|