graticule 1.0.0.pre2 → 2.0.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.
- 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/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
1.0.0.pre2
|
data/graticule.gemspec
DELETED
@@ -1,199 +0,0 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run the gemspec command
|
4
|
-
# -*- encoding: utf-8 -*-
|
5
|
-
|
6
|
-
Gem::Specification.new do |s|
|
7
|
-
s.name = %q{graticule}
|
8
|
-
s.version = "1.0.0.pre2"
|
9
|
-
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = ["Brandon Keepers"]
|
12
|
-
s.date = %q{2010-02-04}
|
13
|
-
s.default_executable = %q{geocode}
|
14
|
-
s.description = %q{Graticule is a geocoding API that provides a common interface to all the popular services, including Google, Yahoo, Geocoder.us, and MetaCarta.}
|
15
|
-
s.email = %q{brandon@opensoul.org}
|
16
|
-
s.executables = ["geocode"]
|
17
|
-
s.extra_rdoc_files = [
|
18
|
-
"README.txt"
|
19
|
-
]
|
20
|
-
s.files = [
|
21
|
-
".autotest",
|
22
|
-
".gitignore",
|
23
|
-
"CHANGELOG.txt",
|
24
|
-
"LICENSE.txt",
|
25
|
-
"README.txt",
|
26
|
-
"Rakefile",
|
27
|
-
"VERSION",
|
28
|
-
"bin/geocode",
|
29
|
-
"graticule.gemspec",
|
30
|
-
"init.rb",
|
31
|
-
"lib/graticule.rb",
|
32
|
-
"lib/graticule/cli.rb",
|
33
|
-
"lib/graticule/core_ext.rb",
|
34
|
-
"lib/graticule/distance.rb",
|
35
|
-
"lib/graticule/distance/haversine.rb",
|
36
|
-
"lib/graticule/distance/spherical.rb",
|
37
|
-
"lib/graticule/distance/vincenty.rb",
|
38
|
-
"lib/graticule/geocoder.rb",
|
39
|
-
"lib/graticule/geocoder/base.rb",
|
40
|
-
"lib/graticule/geocoder/bogus.rb",
|
41
|
-
"lib/graticule/geocoder/freethepostcode.rb",
|
42
|
-
"lib/graticule/geocoder/geocoder_ca.rb",
|
43
|
-
"lib/graticule/geocoder/geocoder_us.rb",
|
44
|
-
"lib/graticule/geocoder/geonames.rb",
|
45
|
-
"lib/graticule/geocoder/google.rb",
|
46
|
-
"lib/graticule/geocoder/host_ip.rb",
|
47
|
-
"lib/graticule/geocoder/local_search_maps.rb",
|
48
|
-
"lib/graticule/geocoder/mapquest.rb",
|
49
|
-
"lib/graticule/geocoder/multi.rb",
|
50
|
-
"lib/graticule/geocoder/multimap.rb",
|
51
|
-
"lib/graticule/geocoder/yahoo.rb",
|
52
|
-
"lib/graticule/location.rb",
|
53
|
-
"lib/graticule/precision.rb",
|
54
|
-
"site/index.html",
|
55
|
-
"site/plugin.html",
|
56
|
-
"site/stylesheets/style.css",
|
57
|
-
"test/config.yml.default",
|
58
|
-
"test/fixtures/responses/freethepostcode/not_found.txt",
|
59
|
-
"test/fixtures/responses/freethepostcode/success.txt",
|
60
|
-
"test/fixtures/responses/geocoder_ca/success.xml",
|
61
|
-
"test/fixtures/responses/geocoder_us/success.xml",
|
62
|
-
"test/fixtures/responses/geocoder_us/unknown.xml",
|
63
|
-
"test/fixtures/responses/geonames/missing.xml",
|
64
|
-
"test/fixtures/responses/geonames/success.xml",
|
65
|
-
"test/fixtures/responses/geonames/unknown.xml",
|
66
|
-
"test/fixtures/responses/google/badkey.xml",
|
67
|
-
"test/fixtures/responses/google/limit.xml",
|
68
|
-
"test/fixtures/responses/google/missing_address.xml",
|
69
|
-
"test/fixtures/responses/google/only_coordinates.xml",
|
70
|
-
"test/fixtures/responses/google/partial.xml",
|
71
|
-
"test/fixtures/responses/google/server_error.xml",
|
72
|
-
"test/fixtures/responses/google/success.xml",
|
73
|
-
"test/fixtures/responses/google/success_multiple_results.xml",
|
74
|
-
"test/fixtures/responses/google/unavailable.xml",
|
75
|
-
"test/fixtures/responses/google/unknown_address.xml",
|
76
|
-
"test/fixtures/responses/host_ip/private.txt",
|
77
|
-
"test/fixtures/responses/host_ip/success.txt",
|
78
|
-
"test/fixtures/responses/host_ip/unknown.txt",
|
79
|
-
"test/fixtures/responses/local_search_maps/empty.txt",
|
80
|
-
"test/fixtures/responses/local_search_maps/not_found.txt",
|
81
|
-
"test/fixtures/responses/local_search_maps/success.txt",
|
82
|
-
"test/fixtures/responses/mapquest/multi_result.xml",
|
83
|
-
"test/fixtures/responses/mapquest/success.xml",
|
84
|
-
"test/fixtures/responses/multimap/missing_params.xml",
|
85
|
-
"test/fixtures/responses/multimap/no_matches.xml",
|
86
|
-
"test/fixtures/responses/multimap/success.xml",
|
87
|
-
"test/fixtures/responses/yahoo/success.xml",
|
88
|
-
"test/fixtures/responses/yahoo/unknown_address.xml",
|
89
|
-
"test/graticule/distance_test.rb",
|
90
|
-
"test/graticule/geocoder/freethepostcode_test.rb",
|
91
|
-
"test/graticule/geocoder/geocoder_ca_test.rb",
|
92
|
-
"test/graticule/geocoder/geocoder_us_test.rb",
|
93
|
-
"test/graticule/geocoder/geocoders.rb",
|
94
|
-
"test/graticule/geocoder/geonames_test.rb",
|
95
|
-
"test/graticule/geocoder/google_test.rb",
|
96
|
-
"test/graticule/geocoder/host_ip_test.rb",
|
97
|
-
"test/graticule/geocoder/local_search_maps_test.rb",
|
98
|
-
"test/graticule/geocoder/mapquest_test.rb",
|
99
|
-
"test/graticule/geocoder/multi_test.rb",
|
100
|
-
"test/graticule/geocoder/multimap_test.rb",
|
101
|
-
"test/graticule/geocoder/yahoo_test.rb",
|
102
|
-
"test/graticule/geocoder_test.rb",
|
103
|
-
"test/graticule/location_test.rb",
|
104
|
-
"test/graticule/precision_test.rb",
|
105
|
-
"test/mocks/uri.rb",
|
106
|
-
"test/test_helper.rb"
|
107
|
-
]
|
108
|
-
s.homepage = %q{http://github.com/collectiveidea/graticule}
|
109
|
-
s.rdoc_options = ["--main", "README.rdoc", "--inline-source", "--line-numbers"]
|
110
|
-
s.require_paths = ["lib"]
|
111
|
-
s.rubyforge_project = %q{graticule}
|
112
|
-
s.rubygems_version = %q{1.3.5}
|
113
|
-
s.summary = %q{API for using all the popular geocoding services.}
|
114
|
-
s.test_files = [
|
115
|
-
"test/config.yml",
|
116
|
-
"test/config.yml.default",
|
117
|
-
"test/fixtures",
|
118
|
-
"test/fixtures/responses",
|
119
|
-
"test/fixtures/responses/freethepostcode",
|
120
|
-
"test/fixtures/responses/freethepostcode/not_found.txt",
|
121
|
-
"test/fixtures/responses/freethepostcode/success.txt",
|
122
|
-
"test/fixtures/responses/geocoder_ca",
|
123
|
-
"test/fixtures/responses/geocoder_ca/success.xml",
|
124
|
-
"test/fixtures/responses/geocoder_us",
|
125
|
-
"test/fixtures/responses/geocoder_us/success.xml",
|
126
|
-
"test/fixtures/responses/geocoder_us/unknown.xml",
|
127
|
-
"test/fixtures/responses/geonames",
|
128
|
-
"test/fixtures/responses/geonames/missing.xml",
|
129
|
-
"test/fixtures/responses/geonames/success.xml",
|
130
|
-
"test/fixtures/responses/geonames/unknown.xml",
|
131
|
-
"test/fixtures/responses/google",
|
132
|
-
"test/fixtures/responses/google/badkey.xml",
|
133
|
-
"test/fixtures/responses/google/limit.xml",
|
134
|
-
"test/fixtures/responses/google/missing_address.xml",
|
135
|
-
"test/fixtures/responses/google/only_coordinates.xml",
|
136
|
-
"test/fixtures/responses/google/partial.xml",
|
137
|
-
"test/fixtures/responses/google/server_error.xml",
|
138
|
-
"test/fixtures/responses/google/success.xml",
|
139
|
-
"test/fixtures/responses/google/success_multiple_results.xml",
|
140
|
-
"test/fixtures/responses/google/unavailable.xml",
|
141
|
-
"test/fixtures/responses/google/unknown_address.xml",
|
142
|
-
"test/fixtures/responses/host_ip",
|
143
|
-
"test/fixtures/responses/host_ip/private.txt",
|
144
|
-
"test/fixtures/responses/host_ip/success.txt",
|
145
|
-
"test/fixtures/responses/host_ip/unknown.txt",
|
146
|
-
"test/fixtures/responses/local_search_maps",
|
147
|
-
"test/fixtures/responses/local_search_maps/empty.txt",
|
148
|
-
"test/fixtures/responses/local_search_maps/not_found.txt",
|
149
|
-
"test/fixtures/responses/local_search_maps/success.txt",
|
150
|
-
"test/fixtures/responses/mapquest",
|
151
|
-
"test/fixtures/responses/mapquest/multi_result.xml",
|
152
|
-
"test/fixtures/responses/mapquest/success.xml",
|
153
|
-
"test/fixtures/responses/multimap",
|
154
|
-
"test/fixtures/responses/multimap/missing_params.xml",
|
155
|
-
"test/fixtures/responses/multimap/no_matches.xml",
|
156
|
-
"test/fixtures/responses/multimap/success.xml",
|
157
|
-
"test/fixtures/responses/yahoo",
|
158
|
-
"test/fixtures/responses/yahoo/success.xml",
|
159
|
-
"test/fixtures/responses/yahoo/unknown_address.xml",
|
160
|
-
"test/graticule",
|
161
|
-
"test/graticule/distance_test.rb",
|
162
|
-
"test/graticule/geocoder",
|
163
|
-
"test/graticule/geocoder/freethepostcode_test.rb",
|
164
|
-
"test/graticule/geocoder/geocoder_ca_test.rb",
|
165
|
-
"test/graticule/geocoder/geocoder_us_test.rb",
|
166
|
-
"test/graticule/geocoder/geocoders.rb",
|
167
|
-
"test/graticule/geocoder/geonames_test.rb",
|
168
|
-
"test/graticule/geocoder/google_test.rb",
|
169
|
-
"test/graticule/geocoder/host_ip_test.rb",
|
170
|
-
"test/graticule/geocoder/local_search_maps_test.rb",
|
171
|
-
"test/graticule/geocoder/mapquest_test.rb",
|
172
|
-
"test/graticule/geocoder/multi_test.rb",
|
173
|
-
"test/graticule/geocoder/multimap_test.rb",
|
174
|
-
"test/graticule/geocoder/yahoo_test.rb",
|
175
|
-
"test/graticule/geocoder_test.rb",
|
176
|
-
"test/graticule/location_test.rb",
|
177
|
-
"test/graticule/precision_test.rb",
|
178
|
-
"test/mocks",
|
179
|
-
"test/mocks/uri.rb",
|
180
|
-
"test/test_helper.rb"
|
181
|
-
]
|
182
|
-
|
183
|
-
if s.respond_to? :specification_version then
|
184
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
185
|
-
s.specification_version = 3
|
186
|
-
|
187
|
-
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
188
|
-
s.add_runtime_dependency(%q<activesupport>, [">= 0"])
|
189
|
-
s.add_runtime_dependency(%q<happymapper>, [">= 0.3.0"])
|
190
|
-
else
|
191
|
-
s.add_dependency(%q<activesupport>, [">= 0"])
|
192
|
-
s.add_dependency(%q<happymapper>, [">= 0.3.0"])
|
193
|
-
end
|
194
|
-
else
|
195
|
-
s.add_dependency(%q<activesupport>, [">= 0"])
|
196
|
-
s.add_dependency(%q<happymapper>, [">= 0.3.0"])
|
197
|
-
end
|
198
|
-
end
|
199
|
-
|
data/init.rb
DELETED
data/site/index.html
DELETED
@@ -1,114 +0,0 @@
|
|
1
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
2
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
3
|
-
|
4
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
5
|
-
<head>
|
6
|
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
7
|
-
<title>Graticule</title>
|
8
|
-
<link rel="stylesheet" type="text/css" href="http://opensoul.org/stylesheets/code.css" />
|
9
|
-
<link rel="stylesheet" type="text/css" href="stylesheets/style.css" />
|
10
|
-
<link href="http://opensoul.org/stylesheets/ci.css" rel="stylesheet" type="text/css" />
|
11
|
-
<script src="http://opensoul.org/javascripts/code_highlighter.js" type="text/javascript"></script>
|
12
|
-
<script src="http://opensoul.org/javascripts/ruby.js" type="text/javascript"></script>
|
13
|
-
</head>
|
14
|
-
|
15
|
-
<body>
|
16
|
-
<div id="collectiveidea">
|
17
|
-
<a href="http://collectiveidea.com"><img src="http://opensoul.org/images/header_logo.gif" alt="Collective Idea" class="logo" width="17" height="22" /></a>
|
18
|
-
<ul class="links">
|
19
|
-
<li><a href="http://daniel.collectiveidea.com/blog">Daniel</a></li>
|
20
|
-
<li><a href="http://opensoul.org">Brandon</a></li>
|
21
|
-
<li class="name"><a href="http://collectiveidea.com"><img src="http://opensoul.org/images/header_collectiveidea.gif" alt="Collective Idea" width="123" height="21" /></a></li>
|
22
|
-
</ul>
|
23
|
-
</div>
|
24
|
-
<div id="main">
|
25
|
-
<div id="header">
|
26
|
-
<h1><a href="/">Graticule</a></h1>
|
27
|
-
<ul id="nav">
|
28
|
-
<li><a href="graticule">API Docs</a></li>
|
29
|
-
<li><a href="plugin.html">Rails Plugin</a></li>
|
30
|
-
<li><a href="http://rubyforge.org/projects/graticule">RubyForge</a></li>
|
31
|
-
<li><a href="http://opensoul.org/tags/geocoding">Blog</a></li>
|
32
|
-
</ul>
|
33
|
-
</div>
|
34
|
-
<div id="content">
|
35
|
-
<dl lang="en" xml:lang="en">
|
36
|
-
<dt><strong>grat·i·cule</strong>, <span class="pronunciation">|ˈgratəˌkyoōl|</span>,
|
37
|
-
<em><abbr title="noun">n.</abbr></em>
|
38
|
-
<span class="description">technical</span>
|
39
|
-
</dt>
|
40
|
-
<dd><em>Navigation.</em> a network of parallels and meridians on a map or chart.</dd>
|
41
|
-
</dl>
|
42
|
-
|
43
|
-
<p>Graticule is a geocoding API for looking up address coordinates and performing distance calculations. It supports many popular APIs, including:</p>
|
44
|
-
|
45
|
-
<ul>
|
46
|
-
<li>Yahoo</li>
|
47
|
-
<li>Google</li>
|
48
|
-
<li>Geocoder.ca</li>
|
49
|
-
<li>Geocoder.us</li>
|
50
|
-
<li>PostcodeAnywhere</li>
|
51
|
-
<li>MetaCarta</li>
|
52
|
-
</ul>
|
53
|
-
|
54
|
-
<p>There is a <a href="plugin.html">companion Rails plugin</a> that makes geocoding seem like magic.</p>
|
55
|
-
|
56
|
-
<h2>Example</h2>
|
57
|
-
|
58
|
-
<pre><code class="ruby">require 'rubygems'
|
59
|
-
require 'graticule'
|
60
|
-
geocoder = Graticule.service(:google).new "api_key"
|
61
|
-
location = geocoder.locate "1600 Amphitheatre Parkway, Mountain View, CA"
|
62
|
-
location.coordinates #=> [37.423021, -122.083739]
|
63
|
-
location.country #=> "US"</code></pre>
|
64
|
-
|
65
|
-
<p>See the <a href="graticule">API documentation</a> for more details.</p>
|
66
|
-
|
67
|
-
<h2>International Support</h2>
|
68
|
-
|
69
|
-
<p>Graticule supports several services with international support. The international geocoders require slightly more structured data than the US ones:</p>
|
70
|
-
|
71
|
-
<pre><code class="ruby">g = Graticule.service(:local_search_maps).new
|
72
|
-
location = g.locate :street => '48 Leicester Square', :locality => 'London', :country => 'UK'
|
73
|
-
location.coordinates #=> [51.510036, -0.130427]</code></pre>
|
74
|
-
|
75
|
-
<h2>Distance Calculation</h2>
|
76
|
-
|
77
|
-
<p>Graticule includes 3 different distance formulas, Spherical (simplest but least accurate), Vincenty (most accurate and most complicated), and Haversine (somewhere inbetween).</p>
|
78
|
-
|
79
|
-
<pre><code class="ruby">location = geocoder.locate("Holland, MI")
|
80
|
-
location.distance_to(geocoder.locate("Chicago, IL"))
|
81
|
-
#=> 101.997458788177</code></pre>
|
82
|
-
|
83
|
-
<h2>Command Line</h2>
|
84
|
-
<p>Graticule also includes a command line interface to the various geocoders:</p>
|
85
|
-
|
86
|
-
<pre>
|
87
|
-
$ geocode -s yahoo -a yahookey Washington, DC
|
88
|
-
Washington, DC US
|
89
|
-
latitude: 38.895222, longitude: -77.036758</pre>
|
90
|
-
|
91
|
-
<h2>Installation</h2>
|
92
|
-
|
93
|
-
<p>Install the gem by executing:</p>
|
94
|
-
|
95
|
-
<pre>gem install graticule</pre>
|
96
|
-
|
97
|
-
<p>Or, download it from <a href="http://rubyforge.org/frs/?group_id=2643">RubyForge</a>.</p>
|
98
|
-
|
99
|
-
<h2>Contributing</h2>
|
100
|
-
|
101
|
-
<p>Contributions are welcome and appreciated! Join the <a href="http://rubyforge.org/mailman/listinfo/graticule-users">mailing list</a> and grab the source from:</p>
|
102
|
-
|
103
|
-
<pre>http://source.collectiveidea.com/public/geocode/trunk/</pre>
|
104
|
-
</div>
|
105
|
-
</div>
|
106
|
-
|
107
|
-
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
|
108
|
-
</script>
|
109
|
-
<script type="text/javascript">
|
110
|
-
_uacct = "UA-194397-7";
|
111
|
-
urchinTracker();
|
112
|
-
</script>
|
113
|
-
</body>
|
114
|
-
</html>
|
data/site/plugin.html
DELETED
@@ -1,82 +0,0 @@
|
|
1
|
-
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
2
|
-
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
3
|
-
|
4
|
-
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
5
|
-
<head>
|
6
|
-
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
7
|
-
<title>acts_as_geocodable - Graticule</title>
|
8
|
-
<link rel="stylesheet" type="text/css" href="http://opensoul.org/stylesheets/code.css" />
|
9
|
-
<link rel="stylesheet" type="text/css" href="stylesheets/style.css" />
|
10
|
-
<link href="http://opensoul.org/stylesheets/ci.css" rel="stylesheet" type="text/css" />
|
11
|
-
<script src="http://opensoul.org/javascripts/code_highlighter.js" type="text/javascript"></script>
|
12
|
-
<script src="http://opensoul.org/javascripts/ruby.js" type="text/javascript"></script>
|
13
|
-
</head>
|
14
|
-
|
15
|
-
<body>
|
16
|
-
<div id="collectiveidea">
|
17
|
-
<a href="http://collectiveidea.com"><img src="http://opensoul.org/images/header_logo.gif" alt="Collective Idea" class="logo" width="17" height="22" /></a>
|
18
|
-
<ul class="links">
|
19
|
-
<li><a href="http://daniel.collectiveidea.com/blog">Daniel</a></li>
|
20
|
-
<li><a href="http://opensoul.org">Brandon</a></li>
|
21
|
-
<li class="name"><a href="http://collectiveidea.com"><img src="http://opensoul.org/images/header_collectiveidea.gif" alt="Collective Idea" width="123" height="21" /></a></li>
|
22
|
-
</ul>
|
23
|
-
</div>
|
24
|
-
<div id="main">
|
25
|
-
<div id="header">
|
26
|
-
<h1><a href="/">Graticule</a> » acts_as_geocodable</h1>
|
27
|
-
<ul id="nav">
|
28
|
-
<li><a href="acts_as_geocodable">API Docs</a></li>
|
29
|
-
<li><a href="plugin.html">Rails Plugin</a></li>
|
30
|
-
<li><a href="http://rubyforge.org/projects/graticule">RubyForge</a></li>
|
31
|
-
<li><a href="http://opensoul.org/tags/geocoding">Blog</a></li>
|
32
|
-
</ul>
|
33
|
-
</div>
|
34
|
-
<div id="content">
|
35
|
-
<p>acts_as_geocodable is a Rails plugin that makes your applications geo-aware. A picture (er, example) is worth a thousand words:</p>
|
36
|
-
|
37
|
-
<h2>Examples</h2>
|
38
|
-
|
39
|
-
<pre><code class="ruby">event = Event.create :street => "777 NE Martin Luther King, Jr. Blvd.",
|
40
|
-
:locality => "Portland", :region => "Oregon", :postal_code => 97232
|
41
|
-
|
42
|
-
# how far am I from RailsConf 2007?
|
43
|
-
event.distance_to "49423" #=> 1807.66560483205
|
44
|
-
|
45
|
-
# Find our new event, and any other ones in the area
|
46
|
-
Event.find(:all, :within => 50, :origin => "97232")
|
47
|
-
|
48
|
-
# Find the nearest restaurant with beer
|
49
|
-
Restaurant.find(:nearest, :origin => event, :conditions => 'beer = true')</code></pre>
|
50
|
-
|
51
|
-
|
52
|
-
<p>See the <a href="acts_as_geocodable">API documentation</a> for more details.</p>
|
53
|
-
|
54
|
-
<h2>IP-based geocoding</h2>
|
55
|
-
|
56
|
-
<p>acts_as_geocodable adds a <code>remote_location</code> method to your Rails controllers for retrieving a user's location based on their remote IP address.</p>
|
57
|
-
|
58
|
-
<pre><code class="ruby">@nearest_store = Store.find(:nearest, :origin => remote_location) if remote_location</code></pre>
|
59
|
-
|
60
|
-
<p>Don't rely too heavily on remote_location because the location of many IP addresses cannot be determined through <a href="http://hostip.info">HostIP</a>.
|
61
|
-
|
62
|
-
<h2>Installation</h2>
|
63
|
-
|
64
|
-
<p>Install the plugin by executing:</p>
|
65
|
-
|
66
|
-
<pre>script/plugin install -x http://source.collectiveidea.com/public/rails/plugins/acts_as_geocodable</pre>
|
67
|
-
|
68
|
-
<h2>Contributing</h2>
|
69
|
-
|
70
|
-
<p>Contributions are welcome and appreciated! Grab the source from:</p>
|
71
|
-
|
72
|
-
<pre>http://source.collectiveidea.com/public/rails/plugins/acts_as_geocodable</pre>
|
73
|
-
</div>
|
74
|
-
</div>
|
75
|
-
<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
|
76
|
-
</script>
|
77
|
-
<script type="text/javascript">
|
78
|
-
_uacct = "UA-194397-7";
|
79
|
-
urchinTracker();
|
80
|
-
</script>
|
81
|
-
</body>
|
82
|
-
</html>
|
data/site/stylesheets/style.css
DELETED
@@ -1,69 +0,0 @@
|
|
1
|
-
body {
|
2
|
-
font-family: "Lucida Grande", Helvetica, Arial, sans-serif;
|
3
|
-
font-size: 76%;
|
4
|
-
background: #2A2A2A;
|
5
|
-
margin: 0;
|
6
|
-
padding: 0;
|
7
|
-
}
|
8
|
-
|
9
|
-
#collectiveidea {
|
10
|
-
border-bottom: 1px solid #444;
|
11
|
-
}
|
12
|
-
|
13
|
-
a {
|
14
|
-
color: #2D5385;
|
15
|
-
}
|
16
|
-
|
17
|
-
#main {
|
18
|
-
background-color: #FFF;
|
19
|
-
width: 700px;
|
20
|
-
margin: 0 auto;
|
21
|
-
border: 5px #CCC;
|
22
|
-
border-left-style: solid;
|
23
|
-
border-right-style: solid;
|
24
|
-
padding: 0 1em;
|
25
|
-
}
|
26
|
-
|
27
|
-
#header {
|
28
|
-
position: relative;
|
29
|
-
}
|
30
|
-
|
31
|
-
#header h1 {
|
32
|
-
margin: 0;
|
33
|
-
padding: 0.5em 0;
|
34
|
-
color: #2D5385;
|
35
|
-
border-bottom: 1px solid #999;
|
36
|
-
}
|
37
|
-
|
38
|
-
#header h1 a {
|
39
|
-
text-decoration: none;
|
40
|
-
}
|
41
|
-
|
42
|
-
#nav {
|
43
|
-
list-style: none;
|
44
|
-
position: absolute;
|
45
|
-
right: 0;
|
46
|
-
top: 0.6em;
|
47
|
-
}
|
48
|
-
#nav li {
|
49
|
-
display: inline;
|
50
|
-
padding: 0 0.5em;
|
51
|
-
}
|
52
|
-
|
53
|
-
#content {
|
54
|
-
padding: 1em 0;
|
55
|
-
}
|
56
|
-
|
57
|
-
dl {
|
58
|
-
background-color: #DDD;
|
59
|
-
padding: 1em;
|
60
|
-
border: 1px solid #CCC;
|
61
|
-
}
|
62
|
-
dl .pronunciation {
|
63
|
-
color: #C00;
|
64
|
-
}
|
65
|
-
dl .description {
|
66
|
-
text-transform: uppercase;
|
67
|
-
font-size: 0.8em;
|
68
|
-
font-family: fixed;
|
69
|
-
}
|