geodublincreate 0.0.2
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/doc/classes/MyCallbacks.html +227 -0
- data/doc/classes/MyCallbacks.src/M000001.html +31 -0
- data/doc/classes/MyCallbacks.src/M000002.html +18 -0
- data/doc/classes/MyCallbacks.src/M000003.html +18 -0
- data/doc/classes/MyCallbacks.src/M000004.html +27 -0
- data/doc/classes/MyCallbacks.src/M000005.html +44 -0
- data/doc/classes/MyCallbacks.src/M000006.html +47 -0
- data/doc/created.rid +1 -0
- data/doc/files/geodublincreate_rb.html +194 -0
- data/doc/fr_class_index.html +27 -0
- data/doc/fr_file_index.html +27 -0
- data/doc/fr_method_index.html +32 -0
- data/doc/index.html +24 -0
- data/doc/rdoc-style.css +208 -0
- data/geodublincreate-0.0.1.gem +0 -0
- data/geodublincreate.gemspec +12 -0
- data/geodublincreate.gemspec~ +12 -0
- data/lib/configuration/database.yml +5 -0
- data/lib/data/dublinmap.osm +0 -0
- data/lib/data/testdata.osm +87976 -0
- data/lib/geodublincreate.rb +271 -0
- data/lib/geodublincreate.rb~ +261 -0
- data/lib/log/loggerfile +1 -0
- metadata +91 -0
@@ -0,0 +1,227 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>Class: MyCallbacks</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="classHeader">
|
50
|
+
<table class="header-table">
|
51
|
+
<tr class="top-aligned-row">
|
52
|
+
<td><strong>Class</strong></td>
|
53
|
+
<td class="class-name-in-header">MyCallbacks</td>
|
54
|
+
</tr>
|
55
|
+
<tr class="top-aligned-row">
|
56
|
+
<td><strong>In:</strong></td>
|
57
|
+
<td>
|
58
|
+
<a href="../files/geodublincreate_rb.html">
|
59
|
+
geodublincreate.rb
|
60
|
+
</a>
|
61
|
+
<br />
|
62
|
+
</td>
|
63
|
+
</tr>
|
64
|
+
|
65
|
+
<tr class="top-aligned-row">
|
66
|
+
<td><strong>Parent:</strong></td>
|
67
|
+
<td>
|
68
|
+
OSM::Callbacks
|
69
|
+
</td>
|
70
|
+
</tr>
|
71
|
+
</table>
|
72
|
+
</div>
|
73
|
+
<!-- banner header -->
|
74
|
+
|
75
|
+
<div id="bodyContent">
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<div id="contextContent">
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
</div>
|
84
|
+
|
85
|
+
<div id="method-list">
|
86
|
+
<h3 class="section-bar">Methods</h3>
|
87
|
+
|
88
|
+
<div class="name-list">
|
89
|
+
<a href="#M000005">extract_data</a>
|
90
|
+
<a href="#M000004">formatandstore</a>
|
91
|
+
<a href="#M000001">new</a>
|
92
|
+
<a href="#M000006">node</a>
|
93
|
+
<a href="#M000003">relation</a>
|
94
|
+
<a href="#M000002">way</a>
|
95
|
+
</div>
|
96
|
+
</div>
|
97
|
+
|
98
|
+
</div>
|
99
|
+
|
100
|
+
|
101
|
+
<!-- if includes -->
|
102
|
+
|
103
|
+
<div id="section">
|
104
|
+
|
105
|
+
|
106
|
+
|
107
|
+
|
108
|
+
|
109
|
+
<div id="attribute-list">
|
110
|
+
<h3 class="section-bar">Attributes</h3>
|
111
|
+
|
112
|
+
<div class="name-list">
|
113
|
+
<table>
|
114
|
+
<tr class="top-aligned-row context-row">
|
115
|
+
<td class="context-item-name">dbconn</td>
|
116
|
+
<td class="context-item-value"> [RW] </td>
|
117
|
+
<td class="context-item-desc"></td>
|
118
|
+
</tr>
|
119
|
+
</table>
|
120
|
+
</div>
|
121
|
+
</div>
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
<!-- if method_list -->
|
126
|
+
<div id="methods">
|
127
|
+
<h3 class="section-bar">Public Class methods</h3>
|
128
|
+
|
129
|
+
<div id="method-M000001" class="method-detail">
|
130
|
+
<a name="M000001"></a>
|
131
|
+
|
132
|
+
<div class="method-heading">
|
133
|
+
<a href="MyCallbacks.src/M000001.html" target="Code" class="method-signature"
|
134
|
+
onclick="popupCode('MyCallbacks.src/M000001.html');return false;">
|
135
|
+
<span class="method-name">new</span><span class="method-args">(conn)</span>
|
136
|
+
</a>
|
137
|
+
</div>
|
138
|
+
|
139
|
+
<div class="method-description">
|
140
|
+
</div>
|
141
|
+
</div>
|
142
|
+
|
143
|
+
<h3 class="section-bar">Public Instance methods</h3>
|
144
|
+
|
145
|
+
<div id="method-M000005" class="method-detail">
|
146
|
+
<a name="M000005"></a>
|
147
|
+
|
148
|
+
<div class="method-heading">
|
149
|
+
<a href="MyCallbacks.src/M000005.html" target="Code" class="method-signature"
|
150
|
+
onclick="popupCode('MyCallbacks.src/M000005.html');return false;">
|
151
|
+
<span class="method-name">extract_data</span><span class="method-args">(id,lon,lat,type,tags)</span>
|
152
|
+
</a>
|
153
|
+
</div>
|
154
|
+
|
155
|
+
<div class="method-description">
|
156
|
+
</div>
|
157
|
+
</div>
|
158
|
+
|
159
|
+
<div id="method-M000004" class="method-detail">
|
160
|
+
<a name="M000004"></a>
|
161
|
+
|
162
|
+
<div class="method-heading">
|
163
|
+
<a href="MyCallbacks.src/M000004.html" target="Code" class="method-signature"
|
164
|
+
onclick="popupCode('MyCallbacks.src/M000004.html');return false;">
|
165
|
+
<span class="method-name">formatandstore</span><span class="method-args">(nodetostore)</span>
|
166
|
+
</a>
|
167
|
+
</div>
|
168
|
+
|
169
|
+
<div class="method-description">
|
170
|
+
</div>
|
171
|
+
</div>
|
172
|
+
|
173
|
+
<div id="method-M000006" class="method-detail">
|
174
|
+
<a name="M000006"></a>
|
175
|
+
|
176
|
+
<div class="method-heading">
|
177
|
+
<a href="MyCallbacks.src/M000006.html" target="Code" class="method-signature"
|
178
|
+
onclick="popupCode('MyCallbacks.src/M000006.html');return false;">
|
179
|
+
<span class="method-name">node</span><span class="method-args">(node)</span>
|
180
|
+
</a>
|
181
|
+
</div>
|
182
|
+
|
183
|
+
<div class="method-description">
|
184
|
+
</div>
|
185
|
+
</div>
|
186
|
+
|
187
|
+
<div id="method-M000003" class="method-detail">
|
188
|
+
<a name="M000003"></a>
|
189
|
+
|
190
|
+
<div class="method-heading">
|
191
|
+
<a href="MyCallbacks.src/M000003.html" target="Code" class="method-signature"
|
192
|
+
onclick="popupCode('MyCallbacks.src/M000003.html');return false;">
|
193
|
+
<span class="method-name">relation</span><span class="method-args">(relation)</span>
|
194
|
+
</a>
|
195
|
+
</div>
|
196
|
+
|
197
|
+
<div class="method-description">
|
198
|
+
</div>
|
199
|
+
</div>
|
200
|
+
|
201
|
+
<div id="method-M000002" class="method-detail">
|
202
|
+
<a name="M000002"></a>
|
203
|
+
|
204
|
+
<div class="method-heading">
|
205
|
+
<a href="MyCallbacks.src/M000002.html" target="Code" class="method-signature"
|
206
|
+
onclick="popupCode('MyCallbacks.src/M000002.html');return false;">
|
207
|
+
<span class="method-name">way</span><span class="method-args">(way)</span>
|
208
|
+
</a>
|
209
|
+
</div>
|
210
|
+
|
211
|
+
<div class="method-description">
|
212
|
+
</div>
|
213
|
+
</div>
|
214
|
+
|
215
|
+
|
216
|
+
</div>
|
217
|
+
|
218
|
+
|
219
|
+
</div>
|
220
|
+
|
221
|
+
|
222
|
+
<div id="validator-badges">
|
223
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
224
|
+
</div>
|
225
|
+
|
226
|
+
</body>
|
227
|
+
</html>
|
@@ -0,0 +1,31 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>new (MyCallbacks)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File geodublincreate.rb, line 77</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">conn</span>)
|
15
|
+
<span class="ruby-ivar">@dbconn</span> = <span class="ruby-identifier">conn</span>
|
16
|
+
<span class="ruby-identifier">dropstring</span> = <span class="ruby-value str">"DROP TABLE IF EXISTS overlays"</span>
|
17
|
+
<span class="ruby-ivar">@dbconn</span>.<span class="ruby-identifier">query</span>(<span class="ruby-identifier">dropstring</span>)
|
18
|
+
<span class="ruby-identifier">createstring</span>=<span class="ruby-value str">"CREATE TABLE overlays
|
19
|
+
(id INT NOT NULL AUTO_INCREMENT ,
|
20
|
+
ref_id INT NOT NULL ,
|
21
|
+
lon DOUBLE NOT NULL ,
|
22
|
+
lat DOUBLE NOT NULL ,
|
23
|
+
name VARCHAR(45) NULL ,
|
24
|
+
amenity VARCHAR(45) NULL ,
|
25
|
+
operator VARCHAR(45) NULL ,
|
26
|
+
typeof VARCHAR(45) NOT NULL ,
|
27
|
+
PRIMARY KEY (id) ) ENGINE = InnoDB;"</span>
|
28
|
+
<span class="ruby-ivar">@dbconn</span>.<span class="ruby-identifier">query</span>(<span class="ruby-identifier">createstring</span>)
|
29
|
+
<span class="ruby-keyword kw">end</span></pre>
|
30
|
+
</body>
|
31
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>way (MyCallbacks)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File geodublincreate.rb, line 94</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">way</span>(<span class="ruby-identifier">way</span>)
|
15
|
+
<span class="ruby-keyword kw">false</span>
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,18 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>relation (MyCallbacks)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File geodublincreate.rb, line 98</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">relation</span>(<span class="ruby-identifier">relation</span>)
|
15
|
+
<span class="ruby-keyword kw">false</span>
|
16
|
+
<span class="ruby-keyword kw">end</span></pre>
|
17
|
+
</body>
|
18
|
+
</html>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>formatandstore (MyCallbacks)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File geodublincreate.rb, line 102</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">formatandstore</span>(<span class="ruby-identifier">nodetostore</span>)
|
15
|
+
<span class="ruby-identifier">insertstring</span> = <span class="ruby-value str">"insert into overlays (ref_id,lon,lat,typeof,name,amenity,operator) values ("</span> <span class="ruby-operator">+</span>
|
16
|
+
<span class="ruby-identifier">nodetostore</span>[<span class="ruby-identifier">:id</span>].<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-value str">","</span> <span class="ruby-operator">+</span>
|
17
|
+
<span class="ruby-identifier">nodetostore</span>[<span class="ruby-identifier">:lon</span>].<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-value str">","</span> <span class="ruby-operator">+</span>
|
18
|
+
<span class="ruby-identifier">nodetostore</span>[<span class="ruby-identifier">:lat</span>].<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-value str">",\""</span> <span class="ruby-operator">+</span>
|
19
|
+
<span class="ruby-identifier">nodetostore</span>[<span class="ruby-identifier">:type</span>].<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-value str">"\",\""</span> <span class="ruby-operator">+</span>
|
20
|
+
<span class="ruby-identifier">nodetostore</span>[<span class="ruby-identifier">:name</span>].<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-value str">"\",\""</span> <span class="ruby-operator">+</span>
|
21
|
+
<span class="ruby-identifier">nodetostore</span>[<span class="ruby-identifier">:amenity</span>].<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-value str">"\",\""</span> <span class="ruby-operator">+</span>
|
22
|
+
<span class="ruby-identifier">nodetostore</span>[<span class="ruby-identifier">:operator</span>].<span class="ruby-identifier">to_s</span> <span class="ruby-operator">+</span> <span class="ruby-value str">"\")"</span>
|
23
|
+
|
24
|
+
<span class="ruby-ivar">@dbconn</span>.<span class="ruby-identifier">query</span>(<span class="ruby-identifier">insertstring</span>)
|
25
|
+
<span class="ruby-keyword kw">end</span></pre>
|
26
|
+
</body>
|
27
|
+
</html>
|
@@ -0,0 +1,44 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>extract_data (MyCallbacks)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File geodublincreate.rb, line 115</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">extract_data</span>(<span class="ruby-identifier">id</span>,<span class="ruby-identifier">lon</span>,<span class="ruby-identifier">lat</span>,<span class="ruby-identifier">type</span>,<span class="ruby-identifier">tags</span>)
|
15
|
+
<span class="ruby-identifier">node_to_store</span> = {<span class="ruby-identifier">:id</span> =<span class="ruby-operator">></span> <span class="ruby-keyword kw">nil</span>,<span class="ruby-identifier">:lon</span> =<span class="ruby-operator">></span> <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">:lat</span> =<span class="ruby-operator">></span> <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">:type</span> =<span class="ruby-operator">></span> <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">:name</span> =<span class="ruby-operator">></span> <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">:amenity</span> =<span class="ruby-operator">></span> <span class="ruby-keyword kw">nil</span>, <span class="ruby-identifier">:operator</span> =<span class="ruby-operator">></span> <span class="ruby-keyword kw">nil</span>}
|
16
|
+
<span class="ruby-identifier">node_to_store</span>[<span class="ruby-identifier">:id</span>] = <span class="ruby-identifier">id</span>
|
17
|
+
<span class="ruby-identifier">node_to_store</span>[<span class="ruby-identifier">:lon</span>] = <span class="ruby-identifier">lon</span>
|
18
|
+
<span class="ruby-identifier">node_to_store</span>[<span class="ruby-identifier">:lat</span>] = <span class="ruby-identifier">lat</span>
|
19
|
+
<span class="ruby-identifier">node_to_store</span>[<span class="ruby-identifier">:type</span>] = <span class="ruby-identifier">type</span>
|
20
|
+
|
21
|
+
<span class="ruby-identifier">tags</span>.<span class="ruby-identifier">each_pair</span> <span class="ruby-keyword kw">do</span>
|
22
|
+
<span class="ruby-operator">|</span> <span class="ruby-identifier">key</span>,<span class="ruby-identifier">value</span> <span class="ruby-operator">|</span>
|
23
|
+
|
24
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">key</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'name'</span>
|
25
|
+
<span class="ruby-identifier">node_to_store</span>[<span class="ruby-identifier">:name</span>] = <span class="ruby-identifier">value</span>
|
26
|
+
<span class="ruby-keyword kw">end</span>
|
27
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">key</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'amenity'</span>
|
28
|
+
<span class="ruby-identifier">node_to_store</span>[<span class="ruby-identifier">:amenity</span>] = <span class="ruby-identifier">value</span>
|
29
|
+
<span class="ruby-keyword kw">end</span>
|
30
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">key</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'operator'</span>
|
31
|
+
<span class="ruby-identifier">node_to_store</span>[<span class="ruby-identifier">:operator</span>] = <span class="ruby-identifier">value</span>
|
32
|
+
<span class="ruby-keyword kw">end</span>
|
33
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">key</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'highway'</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">key</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'railway'</span>
|
34
|
+
<span class="ruby-identifier">node_to_store</span>[<span class="ruby-identifier">:name</span>] = <span class="ruby-identifier">value</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">node_to_store</span>[<span class="ruby-identifier">:name</span>].<span class="ruby-identifier">nil?</span>
|
35
|
+
<span class="ruby-identifier">node_to_store</span>[<span class="ruby-identifier">:amenity</span>] = <span class="ruby-identifier">value</span>
|
36
|
+
<span class="ruby-keyword kw">end</span>
|
37
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">key</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'shop'</span>
|
38
|
+
<span class="ruby-identifier">node_to_store</span>[<span class="ruby-identifier">:amenity</span>] = <span class="ruby-identifier">key</span> <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">node_to_store</span>[<span class="ruby-identifier">:amenity</span>].<span class="ruby-identifier">nil?</span>
|
39
|
+
<span class="ruby-keyword kw">end</span>
|
40
|
+
<span class="ruby-keyword kw">end</span>
|
41
|
+
<span class="ruby-keyword kw">self</span>.<span class="ruby-identifier">formatandstore</span>(<span class="ruby-identifier">node_to_store</span>)
|
42
|
+
<span class="ruby-keyword kw">end</span></pre>
|
43
|
+
</body>
|
44
|
+
</html>
|
@@ -0,0 +1,47 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html>
|
7
|
+
<head>
|
8
|
+
<title>node (MyCallbacks)</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
|
11
|
+
</head>
|
12
|
+
<body class="standalone-code">
|
13
|
+
<pre><span class="ruby-comment cmt"># File geodublincreate.rb, line 145</span>
|
14
|
+
<span class="ruby-keyword kw">def</span> <span class="ruby-identifier">node</span>(<span class="ruby-identifier">node</span>)
|
15
|
+
|
16
|
+
<span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">node</span>.<span class="ruby-identifier">amenity</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'cafe'</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">amenity</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'fast_food'</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">amenity</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'resturant'</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">amenity</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'cafe'</span>)
|
17
|
+
<span class="ruby-identifier">extract_data</span>(<span class="ruby-identifier">node</span>.<span class="ruby-identifier">id</span>,<span class="ruby-identifier">node</span>.<span class="ruby-identifier">lon</span>,<span class="ruby-identifier">node</span>.<span class="ruby-identifier">lat</span>,<span class="ruby-value str">"eating"</span>,<span class="ruby-identifier">node</span>.<span class="ruby-identifier">tags</span>)
|
18
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span>
|
19
|
+
<span class="ruby-keyword kw">end</span>
|
20
|
+
<span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">node</span>.<span class="ruby-identifier">amenity</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'bank'</span> <span class="ruby-keyword kw">and</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">atm</span> = <span class="ruby-value str">"yes"</span>)
|
21
|
+
<span class="ruby-identifier">extract_data</span>(<span class="ruby-identifier">node</span>.<span class="ruby-identifier">id</span>,<span class="ruby-identifier">node</span>.<span class="ruby-identifier">lon</span>,<span class="ruby-identifier">node</span>.<span class="ruby-identifier">lat</span>,<span class="ruby-value str">"atm"</span>,<span class="ruby-identifier">node</span>.<span class="ruby-identifier">tags</span>)
|
22
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span>
|
23
|
+
<span class="ruby-keyword kw">end</span>
|
24
|
+
<span class="ruby-keyword kw">if</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">amenity</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'atm'</span>
|
25
|
+
<span class="ruby-identifier">extract_data</span>(<span class="ruby-identifier">node</span>.<span class="ruby-identifier">id</span>,<span class="ruby-identifier">node</span>.<span class="ruby-identifier">lon</span>,<span class="ruby-identifier">node</span>.<span class="ruby-identifier">lat</span>,<span class="ruby-value str">"atm"</span>,<span class="ruby-identifier">node</span>.<span class="ruby-identifier">tags</span>)
|
26
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span>
|
27
|
+
<span class="ruby-keyword kw">end</span>
|
28
|
+
<span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">node</span>.<span class="ruby-identifier">shop</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'convenience'</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">shop</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'supermarket'</span>)
|
29
|
+
<span class="ruby-identifier">extract_data</span>(<span class="ruby-identifier">node</span>.<span class="ruby-identifier">id</span>,<span class="ruby-identifier">node</span>.<span class="ruby-identifier">lon</span>,<span class="ruby-identifier">node</span>.<span class="ruby-identifier">lat</span>,<span class="ruby-identifier">node</span>.<span class="ruby-identifier">shop</span>,<span class="ruby-identifier">node</span>.<span class="ruby-identifier">tags</span>)
|
30
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span>
|
31
|
+
<span class="ruby-keyword kw">end</span>
|
32
|
+
<span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">node</span>.<span class="ruby-identifier">railway</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'station'</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">railway</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'tram_stop'</span> <span class="ruby-operator">||</span> <span class="ruby-identifier">node</span>.<span class="ruby-identifier">highway</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'bus_stop'</span>)
|
33
|
+
<span class="ruby-identifier">extract_data</span>(<span class="ruby-identifier">node</span>.<span class="ruby-identifier">id</span>,<span class="ruby-identifier">node</span>.<span class="ruby-identifier">lon</span>,<span class="ruby-identifier">node</span>.<span class="ruby-identifier">lat</span>,<span class="ruby-value str">"transport"</span>,<span class="ruby-identifier">node</span>.<span class="ruby-identifier">tags</span>)
|
34
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span>
|
35
|
+
<span class="ruby-keyword kw">end</span>
|
36
|
+
<span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">node</span>.<span class="ruby-identifier">amenity</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'bicycle_rental'</span> )
|
37
|
+
<span class="ruby-identifier">extract_data</span>(<span class="ruby-identifier">node</span>.<span class="ruby-identifier">id</span>,<span class="ruby-identifier">node</span>.<span class="ruby-identifier">lon</span>,<span class="ruby-identifier">node</span>.<span class="ruby-identifier">lat</span>,<span class="ruby-value str">"bike rental"</span>,<span class="ruby-identifier">node</span>.<span class="ruby-identifier">tags</span>)
|
38
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span>
|
39
|
+
<span class="ruby-keyword kw">end</span>
|
40
|
+
<span class="ruby-keyword kw">if</span> (<span class="ruby-identifier">node</span>.<span class="ruby-identifier">amenity</span> <span class="ruby-operator">==</span> <span class="ruby-value str">'pub'</span> )
|
41
|
+
<span class="ruby-identifier">extract_data</span>(<span class="ruby-identifier">node</span>.<span class="ruby-identifier">id</span>,<span class="ruby-identifier">node</span>.<span class="ruby-identifier">lon</span>,<span class="ruby-identifier">node</span>.<span class="ruby-identifier">lat</span>,<span class="ruby-value str">"pub"</span>,<span class="ruby-identifier">node</span>.<span class="ruby-identifier">tags</span>)
|
42
|
+
<span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">true</span>
|
43
|
+
<span class="ruby-keyword kw">end</span>
|
44
|
+
<span class="ruby-keyword kw">false</span>
|
45
|
+
<span class="ruby-keyword kw">end</span></pre>
|
46
|
+
</body>
|
47
|
+
</html>
|
data/doc/created.rid
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
Thu, 27 Jan 2011 15:37:59 +0000
|
@@ -0,0 +1,194 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>File: geodublincreate.rb</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="fileHeader">
|
50
|
+
<h1>geodublincreate.rb</h1>
|
51
|
+
<table class="header-table">
|
52
|
+
<tr class="top-aligned-row">
|
53
|
+
<td><strong>Path:</strong></td>
|
54
|
+
<td>geodublincreate.rb
|
55
|
+
</td>
|
56
|
+
</tr>
|
57
|
+
<tr class="top-aligned-row">
|
58
|
+
<td><strong>Last Update:</strong></td>
|
59
|
+
<td>Thu Jan 27 15:37:37 +0000 2011</td>
|
60
|
+
</tr>
|
61
|
+
</table>
|
62
|
+
</div>
|
63
|
+
<!-- banner header -->
|
64
|
+
|
65
|
+
<div id="bodyContent">
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
<div id="contextContent">
|
70
|
+
|
71
|
+
<div id="description">
|
72
|
+
<p>
|
73
|
+
geodublincreate.rb This file is a ruby file to take as input geo located
|
74
|
+
data. This data is stored to a mysql database. The process will create and
|
75
|
+
load the necessary table to store the geo located services data
|
76
|
+
</p>
|
77
|
+
<p>
|
78
|
+
The process uses the Open Street Map data to find service geo located data
|
79
|
+
such as
|
80
|
+
</p>
|
81
|
+
<pre>
|
82
|
+
- transport services
|
83
|
+
- atm services
|
84
|
+
- bicycle rental services
|
85
|
+
- cafe/resturant services
|
86
|
+
- shopping services
|
87
|
+
|
88
|
+
See http://www.openstreetmap.org for details
|
89
|
+
</pre>
|
90
|
+
<p>
|
91
|
+
Requires Database table ‘overlays’ which is created by the
|
92
|
+
process
|
93
|
+
</p>
|
94
|
+
<p>
|
95
|
+
CREATE TABLE IF NOT EXISTS `event_publisher`.`overlays` (
|
96
|
+
</p>
|
97
|
+
<pre>
|
98
|
+
`id` INT NOT NULL AUTO_INCREMENT ,
|
99
|
+
`ref_id` INT NOT NULL ,
|
100
|
+
`lon` DOUBLE NOT NULL ,
|
101
|
+
`lat` DOUBLE NOT NULL ,
|
102
|
+
`name` VARCHAR(45) NULL ,
|
103
|
+
`amenity` VARCHAR(45) NULL ,
|
104
|
+
`operator` VARCHAR(45) NULL ,
|
105
|
+
`typeof` VARCHAR(45) NOT NULL ,
|
106
|
+
PRIMARY KEY (`id`) )
|
107
|
+
</pre>
|
108
|
+
<p>
|
109
|
+
ENGINE = InnoDB;
|
110
|
+
</p>
|
111
|
+
<pre>
|
112
|
+
Copyright (c) 2011 Sean Cahill
|
113
|
+
Released under the same terms as Ruby
|
114
|
+
</pre>
|
115
|
+
<p>
|
116
|
+
read command line arguments Arguments optional [-f filename] where filename
|
117
|
+
contains osm data
|
118
|
+
</p>
|
119
|
+
<p>
|
120
|
+
Arguments optional if no file passed
|
121
|
+
</p>
|
122
|
+
<pre>
|
123
|
+
bounding box to pull geo located nodes from openstreet data
|
124
|
+
by calling openstreet api
|
125
|
+
|
126
|
+
-n nothern latitude
|
127
|
+
-s southern latitude
|
128
|
+
-w western latiude
|
129
|
+
-e eastern lattitude
|
130
|
+
|
131
|
+
optional argument -mode "test"/"prod"
|
132
|
+
|
133
|
+
example useage
|
134
|
+
|
135
|
+
ruby geodublincreate.rb -f ./data/geocreateddata.osm
|
136
|
+
|
137
|
+
ruby geodublincreate.rb -mode test
|
138
|
+
|
139
|
+
ruby geodublincreate.rb -n 53.3606 -s 53.333 -e -6.2069 -w -6.275
|
140
|
+
|
141
|
+
database configuration file contained in ./data
|
142
|
+
database.yml
|
143
|
+
hostname : name of host server
|
144
|
+
username : mysql database user id
|
145
|
+
password : mysql database password
|
146
|
+
database : mysql database
|
147
|
+
|
148
|
+
log file created in ./log as loggerfile
|
149
|
+
</pre>
|
150
|
+
|
151
|
+
</div>
|
152
|
+
|
153
|
+
<div id="requires-list">
|
154
|
+
<h3 class="section-bar">Required files</h3>
|
155
|
+
|
156
|
+
<div class="name-list">
|
157
|
+
rubygems
|
158
|
+
net/http
|
159
|
+
mysql2
|
160
|
+
OSM/Database
|
161
|
+
OSM/StreamParser
|
162
|
+
yaml
|
163
|
+
</div>
|
164
|
+
</div>
|
165
|
+
|
166
|
+
</div>
|
167
|
+
|
168
|
+
|
169
|
+
</div>
|
170
|
+
|
171
|
+
|
172
|
+
<!-- if includes -->
|
173
|
+
|
174
|
+
<div id="section">
|
175
|
+
|
176
|
+
|
177
|
+
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
<!-- if method_list -->
|
184
|
+
|
185
|
+
|
186
|
+
</div>
|
187
|
+
|
188
|
+
|
189
|
+
<div id="validator-badges">
|
190
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
191
|
+
</div>
|
192
|
+
|
193
|
+
</body>
|
194
|
+
</html>
|