graticule 1.0.0.pre2 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/geocode +0 -0
- data/lib/graticule.rb +2 -0
- data/lib/graticule/geocoder/bogus.rb +1 -1
- data/lib/graticule/geocoder/geonames.rb +1 -1
- data/lib/graticule/geocoder/google.rb +4 -1
- data/lib/graticule/geocoder/host_ip.rb +1 -1
- data/lib/graticule/version.rb +3 -0
- metadata +73 -131
- data/.autotest +0 -13
- data/.gitignore +0 -6
- data/Rakefile +0 -123
- data/VERSION +0 -1
- data/graticule.gemspec +0 -199
- data/init.rb +0 -2
- data/site/index.html +0 -114
- data/site/plugin.html +0 -82
- data/site/stylesheets/style.css +0 -69
- data/test/config.yml.default +0 -33
- data/test/fixtures/responses/freethepostcode/not_found.txt +0 -3
- data/test/fixtures/responses/freethepostcode/success.txt +0 -2
- data/test/fixtures/responses/geocoder_ca/success.xml +0 -12
- data/test/fixtures/responses/geocoder_us/success.xml +0 -8
- data/test/fixtures/responses/geocoder_us/unknown.xml +0 -1
- data/test/fixtures/responses/geonames/missing.xml +0 -4
- data/test/fixtures/responses/geonames/success.xml +0 -14
- data/test/fixtures/responses/geonames/unknown.xml +0 -4
- data/test/fixtures/responses/google/badkey.xml +0 -1
- data/test/fixtures/responses/google/limit.xml +0 -10
- data/test/fixtures/responses/google/missing_address.xml +0 -1
- data/test/fixtures/responses/google/only_coordinates.xml +0 -1
- data/test/fixtures/responses/google/partial.xml +0 -16
- data/test/fixtures/responses/google/server_error.xml +0 -10
- data/test/fixtures/responses/google/success.xml +0 -16
- data/test/fixtures/responses/google/success_multiple_results.xml +0 -88
- data/test/fixtures/responses/google/unavailable.xml +0 -1
- data/test/fixtures/responses/google/unknown_address.xml +0 -8
- data/test/fixtures/responses/host_ip/private.txt +0 -4
- data/test/fixtures/responses/host_ip/success.txt +0 -4
- data/test/fixtures/responses/host_ip/unknown.txt +0 -4
- data/test/fixtures/responses/local_search_maps/empty.txt +0 -1
- data/test/fixtures/responses/local_search_maps/not_found.txt +0 -1
- data/test/fixtures/responses/local_search_maps/success.txt +0 -1
- data/test/fixtures/responses/mapquest/multi_result.xml +0 -1
- data/test/fixtures/responses/mapquest/success.xml +0 -1
- data/test/fixtures/responses/multimap/missing_params.xml +0 -4
- data/test/fixtures/responses/multimap/no_matches.xml +0 -4
- data/test/fixtures/responses/multimap/success.xml +0 -19
- data/test/fixtures/responses/yahoo/success.xml +0 -3
- data/test/fixtures/responses/yahoo/unknown_address.xml +0 -6
- data/test/graticule/distance_test.rb +0 -58
- data/test/graticule/geocoder/freethepostcode_test.rb +0 -36
- data/test/graticule/geocoder/geocoder_ca_test.rb +0 -41
- data/test/graticule/geocoder/geocoder_us_test.rb +0 -43
- data/test/graticule/geocoder/geocoders.rb +0 -55
- data/test/graticule/geocoder/geonames_test.rb +0 -48
- data/test/graticule/geocoder/google_test.rb +0 -107
- data/test/graticule/geocoder/host_ip_test.rb +0 -40
- data/test/graticule/geocoder/local_search_maps_test.rb +0 -30
- data/test/graticule/geocoder/mapquest_test.rb +0 -49
- data/test/graticule/geocoder/multi_test.rb +0 -51
- data/test/graticule/geocoder/multimap_test.rb +0 -52
- data/test/graticule/geocoder/yahoo_test.rb +0 -49
- data/test/graticule/geocoder_test.rb +0 -23
- data/test/graticule/location_test.rb +0 -86
- data/test/graticule/precision_test.rb +0 -37
- data/test/mocks/uri.rb +0 -52
- data/test/test_helper.rb +0 -30
data/test/config.yml.default
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
google:
|
2
|
-
key: PUT YOUR KEY HERE
|
3
|
-
responses:
|
4
|
-
success.xml: "http://maps.google.com/maps/geo?q=1600+amphitheatre+mtn+view+ca&output=xml&key=:key"
|
5
|
-
badkey.xml: http://maps.google.com/maps/geo?q=1600+amphitheatre+mtn+view+ca&output=xml&key=this_is_a_bad_key
|
6
|
-
missing_address.xml: "http://maps.google.com/maps/geo?output=xml&key=:key"
|
7
|
-
unknown_address.xml: "http://maps.google.com/maps/geo?q=xxxxx&output=xml&key=:key"
|
8
|
-
partial.xml: "http://maps.google.com/maps/geo?q=sf+ca&output=xml&key=:key"
|
9
|
-
#unavailable.xml: no way to reproduce this
|
10
|
-
#limit.xml: no way to reproduce this
|
11
|
-
#server_error.xml: no way to reproduce this
|
12
|
-
geocoder_us:
|
13
|
-
responses:
|
14
|
-
success.xml: http://rpc.geocoder.us/service/rest/geocode?address=1600%20Pennsylvania%20Ave%20NW,%20Washington%20DC
|
15
|
-
unknown.xml: http://rpc.geocoder.us/service/rest/geocode?address=1600
|
16
|
-
host_ip:
|
17
|
-
responses:
|
18
|
-
private.txt: http://api.hostip.info/get_html.php?ip=192.168.0.1&position=true
|
19
|
-
success.txt: http://api.hostip.info/get_html.php?ip=64.233.167.99&position=true
|
20
|
-
unknown.txt: http://api.hostip.info/get_html.php?ip=254.254.254.254&position=true
|
21
|
-
local_search_maps:
|
22
|
-
responses:
|
23
|
-
success.txt: http://geo.localsearchmaps.com/?street=48+Leicester+Square&city=London&country=UK
|
24
|
-
empty.txt: http://geo.localsearchmaps.com/
|
25
|
-
not_found.txt: http://geo.localsearchmaps.com/?street=48
|
26
|
-
yahoo:
|
27
|
-
key: PUT YOUR KEY HERE
|
28
|
-
responses:
|
29
|
-
success.xml: http://api.local.yahoo.com/MapsService/V1/geocode?location=701%20First%20Street,%20Sunnyvale,%20CA&output=xml&appid=:key
|
30
|
-
unknown_address.xml: http://api.local.yahoo.com/MapsService/V1/geocode?location=thisprobablycantbefound&output=xml&appid=:key
|
31
|
-
geonames:
|
32
|
-
responses:
|
33
|
-
success.xml: http://ws.geonames.org/timezone?formatted=true&lat=41.85&lng=-87.65&style=full
|
@@ -1,12 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<geodata>
|
3
|
-
<latt>45.418076</latt>
|
4
|
-
<longt>-75.693293</longt>
|
5
|
-
<postal>K2P1P6</postal>
|
6
|
-
<standard>
|
7
|
-
<stnumber>200</stnumber>
|
8
|
-
<staddress>MUTCALF </staddress>
|
9
|
-
<city>ottawa</city>
|
10
|
-
<prov>ON</prov>
|
11
|
-
</standard>
|
12
|
-
</geodata>
|
@@ -1,8 +0,0 @@
|
|
1
|
-
<?xml version="1.0"?>
|
2
|
-
<rdf:RDF xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
|
3
|
-
<geo:Point rdf:nodeID="aid78656681">
|
4
|
-
<dc:description>1600 Pennsylvania Ave NW, Washington DC 20502</dc:description>
|
5
|
-
<geo:long>-77.037684</geo:long>
|
6
|
-
<geo:lat>38.898748</geo:lat>
|
7
|
-
</geo:Point>
|
8
|
-
</rdf:RDF>
|
@@ -1 +0,0 @@
|
|
1
|
-
couldn't find this address! sorry
|
@@ -1,14 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
2
|
-
<geonames>
|
3
|
-
<timezone>
|
4
|
-
<countryCode>US</countryCode>
|
5
|
-
<countryName>United States</countryName>
|
6
|
-
<lat>41.85</lat>
|
7
|
-
<lng>-87.65</lng>
|
8
|
-
<timezoneId>America/Chicago</timezoneId>
|
9
|
-
<dstOffset>-5.0</dstOffset>
|
10
|
-
<gmtOffset>-6.0</gmtOffset>
|
11
|
-
<rawOffset>-6.0</rawOffset>
|
12
|
-
<time>2009-10-07 15:08</time>
|
13
|
-
</timezone>
|
14
|
-
</geonames>
|
@@ -1 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?><kml xmlns="http://earth.google.com/kml/2.1"><Response><name>1600 amphitheatre mtn view ca</name><Status><code>610</code><request>geocode</request></Status></Response></kml>
|
@@ -1 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?><kml xmlns="http://earth.google.com/kml/2.1"><Response><name></name><Status><code>601</code><request>geocode</request></Status></Response></kml>
|
@@ -1 +0,0 @@
|
|
1
|
-
<?xml version='1.0' encoding='UTF-8'?><kml xmlns='http://earth.google.com/kml/2.0'><Response><name>15-17 </name><Status><code>200</code><request>geocode</request></Status><Placemark id='p1'><Point><coordinates>-17.000000,15.000000,0</coordinates></Point></Placemark></Response></kml>
|
@@ -1,16 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8" ?>
|
2
|
-
<kml xmlns="http://earth.google.com/kml/2.0"><Response>
|
3
|
-
<name>sf ca</name>
|
4
|
-
<Status>
|
5
|
-
<code>200</code>
|
6
|
-
<request>geocode</request>
|
7
|
-
</Status>
|
8
|
-
<Placemark id="p1">
|
9
|
-
<address>San Francisco, CA, USA</address>
|
10
|
-
<AddressDetails Accuracy="4" xmlns="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0"><Country><CountryNameCode>US</CountryNameCode><CountryName>USA</CountryName><AdministrativeArea><AdministrativeAreaName>CA</AdministrativeAreaName><Locality><LocalityName>San Francisco</LocalityName></Locality></AdministrativeArea></Country></AddressDetails>
|
11
|
-
<ExtendedData>
|
12
|
-
<LatLonBox north="37.8457283" south="37.7046163" east="-122.2911496" west="-122.5472684" />
|
13
|
-
</ExtendedData>
|
14
|
-
<Point><coordinates>-122.4192090,37.7752060,0</coordinates></Point>
|
15
|
-
</Placemark>
|
16
|
-
</Response></kml>
|
@@ -1,16 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8" ?>
|
2
|
-
<kml xmlns="http://earth.google.com/kml/2.0"><Response>
|
3
|
-
<name>1600 amphitheatre mtn view ca</name>
|
4
|
-
<Status>
|
5
|
-
<code>200</code>
|
6
|
-
<request>geocode</request>
|
7
|
-
</Status>
|
8
|
-
<Placemark id="p1">
|
9
|
-
<address>1600 Amphitheatre Pkwy, Mountain View, CA 94043, USA</address>
|
10
|
-
<AddressDetails Accuracy="8" xmlns="urn:oasis:names:tc:ciq:xsdschema:xAL:2.0"><Country><CountryNameCode>US</CountryNameCode><CountryName>USA</CountryName><AdministrativeArea><AdministrativeAreaName>CA</AdministrativeAreaName><Locality><LocalityName>Mountain View</LocalityName><Thoroughfare><ThoroughfareName>1600 Amphitheatre Pkwy</ThoroughfareName></Thoroughfare><PostalCode><PostalCodeNumber>94043</PostalCodeNumber></PostalCode></Locality></AdministrativeArea></Country></AddressDetails>
|
11
|
-
<ExtendedData>
|
12
|
-
<LatLonBox north="37.4251196" south="37.4188244" east="-122.0809954" west="-122.0872906" />
|
13
|
-
</ExtendedData>
|
14
|
-
<Point><coordinates>-122.0850350,37.4231390,0</coordinates></Point>
|
15
|
-
</Placemark>
|
16
|
-
</Response></kml>
|
@@ -1,88 +0,0 @@
|
|
1
|
-
<?xml version='1.0' encoding='UTF-8'?>
|
2
|
-
<kml xmlns='http://earth.google.com/kml/2.0'><Response>
|
3
|
-
<name>Queen St West</name>
|
4
|
-
<Status>
|
5
|
-
<code>200</code>
|
6
|
-
<request>geocode</request>
|
7
|
-
</Status>
|
8
|
-
<Placemark id='p1'>
|
9
|
-
<address>Queen St W, Toronto, ON, Canada</address>
|
10
|
-
<AddressDetails Accuracy='6' xmlns='urn:oasis:names:tc:ciq:xsdschema:xAL:2.0'><Country><CountryNameCode>CA</CountryNameCode><CountryName>Canada</CountryName><AdministrativeArea><AdministrativeAreaName>ON</AdministrativeAreaName><Locality><LocalityName>Toronto</LocalityName><Thoroughfare><ThoroughfareName>Queen St W</ThoroughfareName></Thoroughfare></Locality></AdministrativeArea></Country></AddressDetails>
|
11
|
-
<ExtendedData>
|
12
|
-
<LatLonBox east='-79.3792510' south='43.6387420' west='-79.4460830' north='43.6524210'/>
|
13
|
-
</ExtendedData>
|
14
|
-
<Point><coordinates>-79.4125590,43.6455030,0</coordinates></Point>
|
15
|
-
</Placemark>
|
16
|
-
<Placemark id='p2'>
|
17
|
-
<address>Queen St W, Brampton, ON, Canada</address>
|
18
|
-
<AddressDetails Accuracy='6' xmlns='urn:oasis:names:tc:ciq:xsdschema:xAL:2.0'><Country><CountryNameCode>CA</CountryNameCode><CountryName>Canada</CountryName><AdministrativeArea><AdministrativeAreaName>ON</AdministrativeAreaName><Locality><LocalityName>Brampton</LocalityName><Thoroughfare><ThoroughfareName>Queen St W</ThoroughfareName></Thoroughfare></Locality></AdministrativeArea></Country></AddressDetails>
|
19
|
-
<ExtendedData>
|
20
|
-
<LatLonBox east='-79.7599410' south='43.6477210' west='-79.8030440' north='43.6859000'/>
|
21
|
-
</ExtendedData>
|
22
|
-
<Point><coordinates>-79.7814960,43.6665410,0</coordinates></Point>
|
23
|
-
</Placemark>
|
24
|
-
<Placemark id='p3'>
|
25
|
-
<address>Queen St W, Levin, 5510, New Zealand</address>
|
26
|
-
<AddressDetails Accuracy='6' xmlns='urn:oasis:names:tc:ciq:xsdschema:xAL:2.0'><Country><CountryNameCode>NZ</CountryNameCode><CountryName>New Zealand</CountryName><Locality><LocalityName>Levin</LocalityName><Thoroughfare><ThoroughfareName>Queen St W</ThoroughfareName></Thoroughfare><PostalCode><PostalCodeNumber>5510</PostalCodeNumber></PostalCode></Locality></Country></AddressDetails>
|
27
|
-
<ExtendedData>
|
28
|
-
<LatLonBox east='175.2872230' south='-40.6221080' west='175.2645080' north='-40.6111560'/>
|
29
|
-
</ExtendedData>
|
30
|
-
<Point><coordinates>175.2753040,-40.6170160,0</coordinates></Point>
|
31
|
-
</Placemark>
|
32
|
-
<Placemark id='p4'>
|
33
|
-
<address>Queen St W, Mt Forest, ON, Canada</address>
|
34
|
-
<AddressDetails Accuracy='6' xmlns='urn:oasis:names:tc:ciq:xsdschema:xAL:2.0'><Country><CountryNameCode>CA</CountryNameCode><CountryName>Canada</CountryName><AdministrativeArea><AdministrativeAreaName>ON</AdministrativeAreaName><Locality><LocalityName>Mt Forest</LocalityName><Thoroughfare><ThoroughfareName>Queen St W</ThoroughfareName></Thoroughfare><PostalCode><PostalCodeNumber>N0G</PostalCodeNumber></PostalCode></Locality></AdministrativeArea></Country></AddressDetails>
|
35
|
-
<ExtendedData>
|
36
|
-
<LatLonBox east='-80.7320620' south='43.9748569' west='-80.7542680' north='43.9811521'/>
|
37
|
-
</ExtendedData>
|
38
|
-
<Point><coordinates>-80.7434380,43.9779890,0</coordinates></Point>
|
39
|
-
</Placemark>
|
40
|
-
<Placemark id='p5'>
|
41
|
-
<address>Queen St W, St Marys, ON, Canada</address>
|
42
|
-
<AddressDetails Accuracy='6' xmlns='urn:oasis:names:tc:ciq:xsdschema:xAL:2.0'><Country><CountryNameCode>CA</CountryNameCode><CountryName>Canada</CountryName><AdministrativeArea><AdministrativeAreaName>ON</AdministrativeAreaName><Locality><LocalityName>St Marys</LocalityName><Thoroughfare><ThoroughfareName>Queen St W</ThoroughfareName></Thoroughfare><PostalCode><PostalCodeNumber>N4X</PostalCodeNumber></PostalCode></Locality></AdministrativeArea></Country></AddressDetails>
|
43
|
-
<ExtendedData>
|
44
|
-
<LatLonBox east='-81.1442510' south='43.2548039' west='-81.1674090' north='43.2610991'/>
|
45
|
-
</ExtendedData>
|
46
|
-
<Point><coordinates>-81.1556430,43.2579490,0</coordinates></Point>
|
47
|
-
</Placemark>
|
48
|
-
<Placemark id='p6'>
|
49
|
-
<address>Queen St W, Barrie, ON, Canada</address>
|
50
|
-
<AddressDetails Accuracy='6' xmlns='urn:oasis:names:tc:ciq:xsdschema:xAL:2.0'><Country><CountryNameCode>CA</CountryNameCode><CountryName>Canada</CountryName><AdministrativeArea><AdministrativeAreaName>ON</AdministrativeAreaName><Locality><LocalityName>Barrie</LocalityName><Thoroughfare><ThoroughfareName>Queen St W</ThoroughfareName></Thoroughfare><PostalCode><PostalCodeNumber>L0L</PostalCodeNumber></PostalCode></Locality></AdministrativeArea></Country></AddressDetails>
|
51
|
-
<ExtendedData>
|
52
|
-
<LatLonBox east='-79.8661300' south='44.5748470' west='-79.8859520' north='44.5835790'/>
|
53
|
-
</ExtendedData>
|
54
|
-
<Point><coordinates>-79.8762460,44.5791840,0</coordinates></Point>
|
55
|
-
</Placemark>
|
56
|
-
<Placemark id='p7'>
|
57
|
-
<address>Queen St W, Owen Sound, ON, Canada</address>
|
58
|
-
<AddressDetails Accuracy='6' xmlns='urn:oasis:names:tc:ciq:xsdschema:xAL:2.0'><Country><CountryNameCode>CA</CountryNameCode><CountryName>Canada</CountryName><AdministrativeArea><AdministrativeAreaName>ON</AdministrativeAreaName><Locality><LocalityName>Owen Sound</LocalityName><Thoroughfare><ThoroughfareName>Queen St W</ThoroughfareName></Thoroughfare><PostalCode><PostalCodeNumber>N0H</PostalCodeNumber></PostalCode></Locality></AdministrativeArea></Country></AddressDetails>
|
59
|
-
<ExtendedData>
|
60
|
-
<LatLonBox east='-81.1333070' south='44.6303544' west='-81.1489540' north='44.6366496'/>
|
61
|
-
</ExtendedData>
|
62
|
-
<Point><coordinates>-81.1428830,44.6334130,0</coordinates></Point>
|
63
|
-
</Placemark>
|
64
|
-
<Placemark id='p8'>
|
65
|
-
<address>Queen St W, Mississauga, ON, Canada</address>
|
66
|
-
<AddressDetails Accuracy='6' xmlns='urn:oasis:names:tc:ciq:xsdschema:xAL:2.0'><Country><CountryNameCode>CA</CountryNameCode><CountryName>Canada</CountryName><AdministrativeArea><AdministrativeAreaName>ON</AdministrativeAreaName><Locality><LocalityName>Mississauga</LocalityName><Thoroughfare><ThoroughfareName>Queen St W</ThoroughfareName></Thoroughfare><PostalCode><PostalCodeNumber>L5H</PostalCodeNumber></PostalCode></Locality></AdministrativeArea></Country></AddressDetails>
|
67
|
-
<ExtendedData>
|
68
|
-
<LatLonBox east='-79.5927510' south='43.5315270' west='-79.6117140' north='43.5498140'/>
|
69
|
-
</ExtendedData>
|
70
|
-
<Point><coordinates>-79.6023990,43.5407460,0</coordinates></Point>
|
71
|
-
</Placemark>
|
72
|
-
<Placemark id='p9'>
|
73
|
-
<address>Queen St W, Cambridge, ON, Canada</address>
|
74
|
-
<AddressDetails Accuracy='6' xmlns='urn:oasis:names:tc:ciq:xsdschema:xAL:2.0'><Country><CountryNameCode>CA</CountryNameCode><CountryName>Canada</CountryName><AdministrativeArea><AdministrativeAreaName>ON</AdministrativeAreaName><Locality><LocalityName>Cambridge</LocalityName><Thoroughfare><ThoroughfareName>Queen St W</ThoroughfareName></Thoroughfare><PostalCode><PostalCodeNumber>N3C</PostalCodeNumber></PostalCode></Locality></AdministrativeArea></Country></AddressDetails>
|
75
|
-
<ExtendedData>
|
76
|
-
<LatLonBox east='-80.3108330' south='43.4202100' west='-80.3287680' north='43.4312910'/>
|
77
|
-
</ExtendedData>
|
78
|
-
<Point><coordinates>-80.3202040,43.4267810,0</coordinates></Point>
|
79
|
-
</Placemark>
|
80
|
-
<Placemark id='p10'>
|
81
|
-
<address>Queen St W, Sault Ste. Marie, ON, Canada</address>
|
82
|
-
<AddressDetails Accuracy='6' xmlns='urn:oasis:names:tc:ciq:xsdschema:xAL:2.0'><Country><CountryNameCode>CA</CountryNameCode><CountryName>Canada</CountryName><AdministrativeArea><AdministrativeAreaName>ON</AdministrativeAreaName><Locality><LocalityName>Sault Ste. Marie</LocalityName><Thoroughfare><ThoroughfareName>Queen St W</ThoroughfareName></Thoroughfare><PostalCode><PostalCodeNumber>P6A</PostalCodeNumber></PostalCode></Locality></AdministrativeArea></Country></AddressDetails>
|
83
|
-
<ExtendedData>
|
84
|
-
<LatLonBox east='-84.3411900' south='46.5155194' west='-84.3592850' north='46.5218146'/>
|
85
|
-
</ExtendedData>
|
86
|
-
<Point><coordinates>-84.3506780,46.5187300,0</coordinates></Point>
|
87
|
-
</Placemark>
|
88
|
-
</Response></kml>
|
@@ -1 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?><kml xmlns="http://earth.google.com/kml/2.1"><Response><name>42-44 Hanway Street, London</name><Status><code>602</code><request>geocode</request></Status></Response></kml>
|
@@ -1 +0,0 @@
|
|
1
|
-
alert('Please provide a location');
|
@@ -1 +0,0 @@
|
|
1
|
-
alert('location not found');
|
@@ -1 +0,0 @@
|
|
1
|
-
map.centerAndZoom(new GPoint(-0.130427, 51.510036), 4);
|
@@ -1 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="ISO-8859-1"?><GeocodeResponse><LocationCollection Count="10"><GeoAddress><AdminArea1>US</AdminArea1><AdminArea3>NY</AdminArea3><AdminArea4>Suffolk County</AdminArea4><AdminArea5>Stony Brook</AdminArea5><LatLng><Lat>40.925598</Lat><Lng>-73.141403</Lng></LatLng><ResultCode>A5XCX</ResultCode><SourceId>gaz_us</SourceId></GeoAddress><GeoAddress><AdminArea1>US</AdminArea1><AdminArea3>NY</AdminArea3><AdminArea4>Rockland County</AdminArea4><AdminArea5>Stony Point</AdminArea5><LatLng><Lat>41.229401</Lat><Lng>-73.987503</Lng></LatLng><ResultCode>A5XCX</ResultCode><SourceId>gaz_us</SourceId></GeoAddress><GeoAddress><AdminArea1>US</AdminArea1><AdminArea3>NY</AdminArea3><AdminArea4>Dutchess County</AdminArea4><AdminArea5>Staatsburg</AdminArea5><LatLng><Lat>41.849701</Lat><Lng>-73.930603</Lng></LatLng><ResultCode>A5XCX</ResultCode><SourceId>gaz_us</SourceId></GeoAddress><GeoAddress><AdminArea1>US</AdminArea1><AdminArea3>NY</AdminArea3><AdminArea4>Delaware County</AdminArea4><AdminArea5>Stamford</AdminArea5><LatLng><Lat>42.407200</Lat><Lng>-74.614700</Lng></LatLng><ResultCode>A5XCX</ResultCode><SourceId>gaz_us</SourceId></GeoAddress><GeoAddress><AdminArea1>US</AdminArea1><AdminArea3>NY</AdminArea3><AdminArea4>Clinton County</AdminArea4><AdminArea5>Standish</AdminArea5><LatLng><Lat>44.689201</Lat><Lng>-73.949402</Lng></LatLng><ResultCode>A5XCX</ResultCode><SourceId>gaz_us</SourceId></GeoAddress><GeoAddress><AdminArea1>US</AdminArea1><AdminArea3>NY</AdminArea3><AdminArea4>Albany County</AdminArea4><AdminArea5>Stanford Heights</AdminArea5><LatLng><Lat>42.765598</Lat><Lng>-73.889397</Lng></LatLng><ResultCode>A5XCX</ResultCode><SourceId>gaz_us</SourceId></GeoAddress><GeoAddress><AdminArea1>US</AdminArea1><AdminArea3>NY</AdminArea3><AdminArea4>Dutchess County</AdminArea4><AdminArea5>Stanfordville</AdminArea5><LatLng><Lat>41.867199</Lat><Lng>-73.714699</Lng></LatLng><ResultCode>A5XCX</ResultCode><SourceId>gaz_us</SourceId></GeoAddress><GeoAddress><AdminArea1>US</AdminArea1><AdminArea3>NY</AdminArea3><AdminArea4>Allegany County</AdminArea4><AdminArea5>Stannards</AdminArea5><LatLng><Lat>42.086399</Lat><Lng>-77.922501</Lng></LatLng><ResultCode>A5XCX</ResultCode><SourceId>gaz_us</SourceId></GeoAddress><GeoAddress><AdminArea1>US</AdminArea1><AdminArea3>NY</AdminArea3><AdminArea4>Saint Lawrence County</AdminArea4><AdminArea5>Star Lake</AdminArea5><LatLng><Lat>44.159698</Lat><Lng>-75.031898</Lng></LatLng><ResultCode>A5XCX</ResultCode><SourceId>gaz_us</SourceId></GeoAddress><GeoAddress><AdminArea1>US</AdminArea1><AdminArea3>NY</AdminArea3><AdminArea4>Rensselaer County</AdminArea4><AdminArea5>Stephentown</AdminArea5><LatLng><Lat>42.548599</Lat><Lng>-73.374397</Lng></LatLng><ResultCode>A5XCX</ResultCode><SourceId>gaz_us</SourceId></GeoAddress></LocationCollection></GeocodeResponse>
|
@@ -1 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="ISO-8859-1"?><GeocodeResponse><LocationCollection Count="1"><GeoAddress><AdminArea1>US</AdminArea1><AdminArea3>ME</AdminArea3><AdminArea4>Oxford County</AdminArea4><AdminArea5>Lovell</AdminArea5><PostalCode>04051-3919</PostalCode><Street>44 Allen Rd</Street><LatLng><Lat>44.152019</Lat><Lng>-70.892706</Lng></LatLng><ResultCode>L1AAA</ResultCode><SourceId>navt</SourceId></GeoAddress></LocationCollection></GeocodeResponse>
|
@@ -1,4 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8" ?>
|
2
|
-
<Results xmlns="http://clients.multimap.com/API" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
3
|
-
xsi:schemaLocation="http://clients.multimap.com/API http://clients.multimap.com/Schema/geocode_1.2.xsd"
|
4
|
-
errorCode="MM_GEOCODE_REQUIRED_PARAMETERS_MISSING" locationCount="0" />
|
@@ -1,4 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8" ?>
|
2
|
-
<Results xmlns="http://clients.multimap.com/API" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
3
|
-
xsi:schemaLocation="http://clients.multimap.com/API http://clients.multimap.com/Schema/geocode_1.2.xsd"
|
4
|
-
errorCode="MM_GEOCODE_NO_MATCHES" locationCount="0" />
|
@@ -1,19 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8" ?>
|
2
|
-
<Results xmlns="http://clients.multimap.com/API" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
3
|
-
xsi:schemaLocation="http://clients.multimap.com/API http://clients.multimap.com/Schema/geocode_1.2.xsd" locationCount="1">
|
4
|
-
<Location geocodeQuality="1">
|
5
|
-
<Address>
|
6
|
-
<Street>Oxford Street</Street>
|
7
|
-
<Areas>
|
8
|
-
<Area>LONDON</Area>
|
9
|
-
</Areas>
|
10
|
-
<PostalCode>W1</PostalCode>
|
11
|
-
<DisplayName>Oxford Street, LONDON, W1</DisplayName>
|
12
|
-
<CountryCode>GB</CountryCode>
|
13
|
-
</Address>
|
14
|
-
<Point>
|
15
|
-
<Lat>51.51452</Lat>
|
16
|
-
<Lon>-0.14839</Lon>
|
17
|
-
</Point>
|
18
|
-
</Location>
|
19
|
-
</Results>
|
@@ -1,3 +0,0 @@
|
|
1
|
-
<?xml version="1.0"?>
|
2
|
-
<ResultSet xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:yahoo:maps" xsi:schemaLocation="urn:yahoo:maps http://api.local.yahoo.com/MapsService/V1/GeocodeResponse.xsd"><Result precision="address" warning="The exact location could not be found, here is the closest match: 701 1st Ave, Sunnyvale, CA 94089"><Latitude>37.416397</Latitude><Longitude>-122.025055</Longitude><Address>701 1st Ave</Address><City>Sunnyvale</City><State>CA</State><Zip>94089-1019</Zip><Country>US</Country></Result></ResultSet>
|
3
|
-
<!-- ws01.ydn.re2.yahoo.com uncompressed/chunked Sun Oct 4 17:27:51 PDT 2009 -->
|
@@ -1,58 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
module Graticule
|
4
|
-
module Distance
|
5
|
-
class DistanceFormulaTest < Test::Unit::TestCase
|
6
|
-
EARTH_RADIUS_IN_MILES = 3963.1676
|
7
|
-
EARTH_RADIUS_IN_KILOMETERS = 6378.135
|
8
|
-
|
9
|
-
FORMULAS = [Haversine, Spherical, Vincenty]
|
10
|
-
|
11
|
-
def test_earth_radius
|
12
|
-
assert_equal EARTH_RADIUS_IN_MILES, EARTH_RADIUS[:miles]
|
13
|
-
assert_equal EARTH_RADIUS_IN_KILOMETERS, EARTH_RADIUS[:kilometers]
|
14
|
-
end
|
15
|
-
|
16
|
-
def test_distance
|
17
|
-
washington_dc = Location.new(:latitude => 38.898748, :longitude => -77.037684)
|
18
|
-
chicago = Location.new(:latitude => 41.85, :longitude => -87.65)
|
19
|
-
|
20
|
-
FORMULAS.each do |formula|
|
21
|
-
assert_in_delta formula.distance(washington_dc, chicago), formula.distance(chicago, washington_dc), 0.00001
|
22
|
-
assert_in_delta 594.820, formula.distance(washington_dc, chicago), 1.0
|
23
|
-
assert_in_delta 594.820, formula.distance(washington_dc, chicago, :miles), 1.0
|
24
|
-
assert_in_delta 957.275, formula.distance(washington_dc, chicago, :kilometers), 1.0
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
def test_distance_between_antipodal_points
|
29
|
-
# The Vincenty formula will be indeterminant with antipodal points.
|
30
|
-
# See http://mathworld.wolfram.com/AntipodalPoints.html
|
31
|
-
washington_dc = Location.new(:latitude => 38.898748, :longitude => -77.037684)
|
32
|
-
chicago = Location.new(:latitude => 41.85, :longitude => -87.65)
|
33
|
-
|
34
|
-
# First, test the deltas.
|
35
|
-
FORMULAS.each do |formula|
|
36
|
-
assert_in_delta 12450.6582171051,
|
37
|
-
formula.distance(chicago, chicago.antipodal_location), 1.0
|
38
|
-
assert_in_delta 12450.6582171051,
|
39
|
-
formula.distance(washington_dc, washington_dc.antipodal_location), 1.0
|
40
|
-
assert_in_delta 12450.6582171051,
|
41
|
-
formula.distance(chicago, chicago.antipodal_location, :miles), 1.0
|
42
|
-
assert_in_delta 12450.6582171051,
|
43
|
-
formula.distance(washington_dc, washington_dc.antipodal_location, :miles), 1.0
|
44
|
-
assert_in_delta 20037.50205960391,
|
45
|
-
formula.distance(chicago, chicago.antipodal_location, :kilometers), 1.0
|
46
|
-
assert_in_delta 20037.5020596039,
|
47
|
-
formula.distance(washington_dc, washington_dc.antipodal_location, :kilometers), 1.0
|
48
|
-
end
|
49
|
-
|
50
|
-
# Next, test Vincenty. Vincenty will use haversine instead of returning NaN on antipodal points
|
51
|
-
assert_equal Haversine.distance(washington_dc, washington_dc.antipodal_location),
|
52
|
-
Vincenty.distance(washington_dc, washington_dc.antipodal_location)
|
53
|
-
assert_equal Haversine.distance(chicago, chicago.antipodal_location),
|
54
|
-
Vincenty.distance(chicago, chicago.antipodal_location)
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
@@ -1,36 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
module Graticule
|
4
|
-
module Geocoder
|
5
|
-
class FreeThePostcodeTest < Test::Unit::TestCase
|
6
|
-
|
7
|
-
def setup
|
8
|
-
URI::HTTP.responses = []
|
9
|
-
URI::HTTP.uris = []
|
10
|
-
@geocoder = FreeThePostcode.new
|
11
|
-
end
|
12
|
-
|
13
|
-
def test_success
|
14
|
-
return unless prepare_response(:success)
|
15
|
-
|
16
|
-
location = Location.new(
|
17
|
-
:latitude => 51.503172,
|
18
|
-
:longitude => -0.241641)
|
19
|
-
|
20
|
-
assert_equal location, @geocoder.locate('W1A 1AA')
|
21
|
-
end
|
22
|
-
|
23
|
-
def test_locate_unknown_address
|
24
|
-
return unless prepare_response(:not_found)
|
25
|
-
assert_raises(AddressError) { @geocoder.locate 'Z12 9pp' }
|
26
|
-
end
|
27
|
-
|
28
|
-
protected
|
29
|
-
|
30
|
-
def prepare_response(id = :success)
|
31
|
-
URI::HTTP.responses << response('freethepostcode', id, 'txt')
|
32
|
-
end
|
33
|
-
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
@@ -1,41 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
module Graticule
|
4
|
-
module Geocoder
|
5
|
-
class GeocoderCaTest < Test::Unit::TestCase
|
6
|
-
|
7
|
-
def setup
|
8
|
-
URI::HTTP.responses = []
|
9
|
-
URI::HTTP.uris = []
|
10
|
-
|
11
|
-
@geocoder = GeocoderCa.new
|
12
|
-
@location = Location.new(
|
13
|
-
:latitude => 45.418076,
|
14
|
-
:longitude => -75.693293,
|
15
|
-
:locality => "ottawa",
|
16
|
-
:precision => :unknown,
|
17
|
-
:region => "ON",
|
18
|
-
:street => "200 MUTCALF "
|
19
|
-
)
|
20
|
-
end
|
21
|
-
|
22
|
-
def test_success
|
23
|
-
prepare_response(:success)
|
24
|
-
assert_equal @location, @geocoder.locate('200 mutcalf, ottawa on')
|
25
|
-
end
|
26
|
-
|
27
|
-
def test_url
|
28
|
-
prepare_response(:success)
|
29
|
-
@geocoder.locate('200 mutcalf, ottawa on')
|
30
|
-
assert_equal 'http://geocoder.ca/?geoit=XML&locate=200%20mutcalf,%20ottawa%20on&showpostal=1&standard=1',
|
31
|
-
URI::HTTP.uris.first
|
32
|
-
end
|
33
|
-
|
34
|
-
protected
|
35
|
-
def prepare_response(id)
|
36
|
-
URI::HTTP.responses << response('geocoder_ca', id)
|
37
|
-
end
|
38
|
-
|
39
|
-
end
|
40
|
-
end
|
41
|
-
end
|