gooby 1.1.0 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README +200 -35
- data/bin/code_scan.rb +1 -3
- data/bin/gooby_been_there.rb +12 -14
- data/bin/gooby_config.rb +11 -3
- data/bin/gooby_csv_validation.rb +50 -0
- data/bin/gooby_first_trackpoints_as_poi.rb +31 -0
- data/bin/gooby_gen_gmap.rb +7 -3
- data/bin/gooby_parser.rb +7 -5
- data/bin/gooby_splitter.rb +7 -4
- data/bin/gooby_version.rb +7 -3
- data/bin/run_all.sh +12 -2
- data/bin/run_been_there.sh +4 -1
- data/bin/run_config.sh +12 -0
- data/bin/run_csv_validation.sh +15 -0
- data/bin/run_db_gen.sh +1 -1
- data/bin/run_db_load.sh +1 -1
- data/bin/run_first_trackpoints_as_poi.sh +16 -0
- data/bin/run_gen_gmaps.sh +7 -6
- data/bin/run_parse_full.sh +45 -0
- data/bin/run_parse_samples.sh +21 -0
- data/bin/run_split.sh +5 -4
- data/bin/run_version.sh +12 -0
- data/config/gooby_config.yaml +130 -131
- data/data/20050305_corporate_cup_hm.csv +251 -251
- data/data/20050430_nashville_marathon_km.csv +1208 -0
- data/data/20060115_phoenix_marathon.csv +1280 -1280
- data/data/20070101_davidson_11m.csv +251 -0
- data/data/{davidson_11m_20070101.xml → 20070101_davidson_11m.xml} +0 -0
- data/data/{davidson_5K_20070505.xml → 20070505_davidson_5k.xml} +0 -0
- data/data/20070505_davidson_5k_km.csv +286 -0
- data/data/hrm1.csv +5 -0
- data/lib/gooby.rb +27 -3144
- data/lib/gooby_code_scanner.rb +288 -0
- data/lib/gooby_command.rb +210 -0
- data/lib/gooby_configuration.rb +123 -0
- data/lib/gooby_counter_hash.rb +95 -0
- data/lib/gooby_course.rb +117 -0
- data/lib/gooby_csv_point.rb +71 -0
- data/lib/gooby_csv_reader.rb +71 -0
- data/lib/gooby_csv_run.rb +28 -0
- data/lib/gooby_delim_line.rb +42 -0
- data/lib/gooby_dttm.rb +87 -0
- data/lib/gooby_duration.rb +86 -0
- data/lib/gooby_forerunner_xml_parser.rb +191 -0
- data/lib/gooby_forerunner_xml_splitter.rb +115 -0
- data/lib/gooby_google_map_generator.rb +385 -0
- data/lib/gooby_history.rb +41 -0
- data/lib/gooby_kernel.rb +163 -0
- data/lib/gooby_lap.rb +30 -0
- data/lib/gooby_line.rb +80 -0
- data/lib/gooby_object.rb +22 -0
- data/lib/gooby_point.rb +172 -0
- data/lib/gooby_run.rb +213 -0
- data/lib/gooby_simple_xml_parser.rb +50 -0
- data/lib/gooby_test_helper.rb +23 -0
- data/lib/gooby_track.rb +47 -0
- data/lib/gooby_track_point.rb +229 -0
- data/lib/gooby_training_center_xml_parser.rb +224 -0
- data/lib/gooby_training_center_xml_splitter.rb +116 -0
- data/lib/split_code.sh +29 -0
- data/samples/20050305_corporate_cup_hm.html +269 -269
- data/samples/20050430_nashville_marathon.html +1410 -1266
- data/samples/20060115_phoenix_marathon.html +1311 -1311
- data/samples/{davidson_11m_20070101.html → 20070101_davidson_11m.html} +267 -267
- data/samples/20070505_davidson_5k.html +413 -0
- data/samples/been_there.txt +52 -704
- data/samples/hrm1.html +87 -0
- data/sql/gooby.ddl +20 -16
- data/sql/gooby_load.dml +36 -9
- metadata +48 -14
- data/bin/example_usage.txt +0 -55
- data/bin/run_parse.sh +0 -43
- data/bin/run_parse_named.sh +0 -19
- data/data/20050430_nashville_marathon.csv +0 -1208
- data/data/davidson_11m_20070101.csv +0 -251
- data/data/davidson_5K_20070505.csv +0 -286
- data/data/test1.txt +0 -4
- data/samples/davidson_5K_20070505.html +0 -395
data/README
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
= Gooby = Google APIs + Ruby
|
2
2
|
|
3
|
-
Version: 1.
|
3
|
+
Version: 1.2.0 - 2007/07/22
|
4
4
|
|
5
|
-
Gooby = Google APIs + Ruby. Release 1.
|
5
|
+
Gooby = Google APIs + Ruby. Release 1.2.0 generates Google maps from GPS data
|
6
6
|
exported by your Garmin Forerunner GPS unit, or manually edited CSV file.
|
7
7
|
Please see the README file. Feedback is requested.
|
8
8
|
|
@@ -12,6 +12,9 @@ http://www.joakim-systems.com:8219/gmap/ccc_half_2005
|
|
12
12
|
http://www.joakim-systems.com:8219/gmap/nashville_marathon_2005
|
13
13
|
http://www.joakim-systems.com:8219/gmap/phoenix_marathon_2006
|
14
14
|
|
15
|
+
This README document is available at:
|
16
|
+
http://www.joakim-systems.com:8219/gooby/readme
|
17
|
+
|
15
18
|
---
|
16
19
|
|
17
20
|
This gem contains 'Gooby', a set of Ruby code to assist you with using and
|
@@ -28,7 +31,7 @@ as created in one of the following three ways.
|
|
28
31
|
|
29
32
|
Google maps are applicable really to any outdoor activity for which GPS data
|
30
33
|
can be obtained. The focus of Gooby is on running, because the author is a
|
31
|
-
marathon runner, and the Garmin Forerunner (I use
|
34
|
+
marathon runner, and the Garmin Forerunner (I use models 201, 205, and 305)
|
32
35
|
is primarily intended for running. Other activities, such as cycling, hiking,
|
33
36
|
walking, driving, and even golfing are also well suited for Gooby. Please let
|
34
37
|
me know how you use Gooby! Feedback is requested.
|
@@ -39,7 +42,7 @@ and Rails integration may be done in a later release.
|
|
39
42
|
= General
|
40
43
|
|
41
44
|
Author:: Chris Joakim <chris@joakim-systems.com>
|
42
|
-
Requires:: Ruby 1.8.
|
45
|
+
Requires:: Ruby 1.8.4 or later
|
43
46
|
License:: Copyright 2007 by Chris Joakim.
|
44
47
|
GNU General Public License (GPL) license.
|
45
48
|
See http://www.gnu.org/copyleft/gpl.html
|
@@ -58,7 +61,7 @@ The latest version of gooby can be found at
|
|
58
61
|
Gooby is packaged and installed as a ruby 'gem'. Download the latest gem to
|
59
62
|
your computer, then run the following command from your download directory.
|
60
63
|
|
61
|
-
gem install gooby-1.
|
64
|
+
gem install gooby-1.2.0.gem
|
62
65
|
|
63
66
|
== Online Resources
|
64
67
|
|
@@ -73,7 +76,35 @@ gem install gooby-1.1.0.gem
|
|
73
76
|
http://www.joakim-systems.com:8219/gmap/phoenix_marathon_2006
|
74
77
|
http://www.joakim-systems.com:8219/gmap/gps_data_capture
|
75
78
|
|
76
|
-
|
79
|
+
|
80
|
+
== This Release - 1.2.0
|
81
|
+
|
82
|
+
* Added support for the Garmin 305 Heartbeat monitor.
|
83
|
+
- Heartbeat values are captured in the XML parsing process.
|
84
|
+
- CSV file format expanded to include heartbeat.
|
85
|
+
- Database DDL modified to add the heartbeat column.
|
86
|
+
- Generated Google Maps now have heartbeat in the popup windows.
|
87
|
+
- Legacy Garmin 201 and Garmin 205 CSV files and Google Maps simply
|
88
|
+
omit the heartbeat information.
|
89
|
+
- Heartbeat is displayed, if data is present, in the new Gooby 1.1.0
|
90
|
+
"been_there" reports. This may be interesting for hill-climbers
|
91
|
+
and interval-trainers.
|
92
|
+
|
93
|
+
* Added support for the English (miles) or Metric (kilometers) systems.
|
94
|
+
- Either 'mi' or 'km' is specified in the XML parsing process.
|
95
|
+
- mi or km unit-of-measure is retained in the CSV files.
|
96
|
+
- Generated Google Maps now generate markers at either integer
|
97
|
+
miles or kilometers, depending on the input CSV file.
|
98
|
+
- Generated Google Map popup windows display the unit-of-measure.
|
99
|
+
|
100
|
+
Special thanks to Karl Otto Emanuelsson for his suggestion to add
|
101
|
+
metric system support.
|
102
|
+
|
103
|
+
* Refactored the codebase into individual class and module files, rather
|
104
|
+
than the previous monolithic gooby.rb file.
|
105
|
+
|
106
|
+
|
107
|
+
== Previous Release - 1.1.0
|
77
108
|
|
78
109
|
* Greatly simplify usage and command-line argument handling.
|
79
110
|
See the shell scripts and ruby files in the /bin directory for examples.
|
@@ -126,9 +157,14 @@ gem install gooby-1.1.0.gem
|
|
126
157
|
Internet Explorer at times. Script error after loading the map background,
|
127
158
|
but before the map route is drawn.
|
128
159
|
|
160
|
+
Note: The Google Map v2 code seems to have been significantly improved for
|
161
|
+
Windows Explorer during Q2 2007, as the Gooby-generated Google Maps now
|
162
|
+
display properly in IE.
|
163
|
+
|
129
164
|
* Add Rails support for realtime dynamic map/content generation.
|
130
165
|
|
131
|
-
* Parse cadence
|
166
|
+
* Parse cadence information from Garmin export file for cyclists.
|
167
|
+
Note: Please provide me a sample file.
|
132
168
|
|
133
169
|
* Add other Google APIs (earth, search, sitemaps, froogle, etc).
|
134
170
|
|
@@ -141,16 +177,59 @@ a bug, on the Tracker page.
|
|
141
177
|
|
142
178
|
= Usage
|
143
179
|
|
144
|
-
See the shell scripts and corresponding ruby files in the /bin directory
|
180
|
+
See the 'run_xxx.sh' shell scripts and corresponding ruby files in the /bin directory
|
181
|
+
for actual working examples used during Gooby development and testing.
|
182
|
+
|
145
183
|
The following in-line text shows both the shell and ruby code.
|
146
184
|
|
147
|
-
Function 1 -
|
185
|
+
Function 1 - Gooby Version Information
|
186
|
+
-------------------------------------------
|
187
|
+
shell:
|
188
|
+
|
189
|
+
ruby /devtools/workspace/RF_Gooby/bin/gooby_version.rb
|
190
|
+
|
191
|
+
ruby:
|
192
|
+
|
193
|
+
require 'rubygems'
|
194
|
+
require 'gooby'
|
195
|
+
include REXML
|
196
|
+
|
197
|
+
config_filename = '/devtools/workspace/RF_Gooby/config/gooby_config.yaml'
|
198
|
+
|
199
|
+
gooby = Gooby::GoobyCommand.new(config_filename)
|
200
|
+
gooby.display_version
|
201
|
+
|
202
|
+
|
203
|
+
Function 2 - Gooby Configuration YAML Contents
|
204
|
+
----------------------------------------------
|
205
|
+
shell:
|
206
|
+
|
207
|
+
ruby /devtools/workspace/RF_Gooby/bin/gooby_config.rb
|
208
|
+
|
209
|
+
ruby:
|
210
|
+
|
211
|
+
require 'rubygems'
|
212
|
+
require 'gooby'
|
213
|
+
include REXML
|
214
|
+
|
215
|
+
config_filename = '/devtools/workspace/RF_Gooby/config/gooby_config.yaml'
|
216
|
+
|
217
|
+
gooby = Gooby::GoobyCommand.new(config_filename)
|
218
|
+
gooby.display_configuration
|
219
|
+
|
220
|
+
|
221
|
+
Function 3 - Garmin XML/TCX file splitting:
|
148
222
|
-------------------------------------------
|
149
223
|
shell:
|
150
224
|
|
225
|
+
rm /temp/splits/*.*
|
226
|
+
|
151
227
|
ruby /devtools/workspace/RF_Gooby/bin/gooby_splitter.rb garmin201 /devtools/workspace/RF_Gooby/data/raw/forerunner_201_2007.xml /temp/splits
|
152
228
|
ruby /devtools/workspace/RF_Gooby/bin/gooby_splitter.rb garmin205 /devtools/workspace/RF_Gooby/data/raw/forerunner_205_2007.tcx /temp/splits
|
229
|
+
ruby /devtools/workspace/RF_Gooby/bin/gooby_splitter.rb garmin305 /devtools/workspace/RF_Gooby/data/raw/forerunner_305_2007.tcx /temp/splits
|
153
230
|
|
231
|
+
ls -al /temp/splits
|
232
|
+
|
154
233
|
ruby:
|
155
234
|
|
156
235
|
require 'rubygems'
|
@@ -162,18 +241,15 @@ Function 1 - Garmin XML/TCX file splitting:
|
|
162
241
|
gooby = Gooby::GoobyCommand.new(config_filename)
|
163
242
|
gooby.display_version
|
164
243
|
gooby.split_garmin_export_file(ARGV)
|
165
|
-
|
166
|
-
|
167
|
-
Function
|
244
|
+
|
245
|
+
|
246
|
+
Function 4 - Garmin XML/TCX file parsing:
|
168
247
|
-----------------------------------------
|
169
248
|
shell:
|
170
249
|
|
171
|
-
ruby /devtools/workspace/RF_Gooby/bin/gooby_parser.rb
|
172
|
-
|
173
|
-
ruby /devtools/workspace/RF_Gooby/bin/gooby_parser.rb
|
174
|
-
/devtools/workspace/RF_Gooby/data/2007_g205.csv
|
175
|
-
ruby /devtools/workspace/RF_Gooby/bin/gooby_parser.rb garmin201 /devtools/workspace/RF_Gooby/data/20060115_phoenix_marathon.xml >
|
176
|
-
/devtools/workspace/RF_Gooby/data/20060115_phoenix_marathon.csv
|
250
|
+
ruby /devtools/workspace/RF_Gooby/bin/gooby_parser.rb garmin201 mi /devtools/workspace/RF_Gooby/data/20060115_phoenix_marathon.xml > /devtools/workspace/RF_Gooby/data/20060115_phoenix_marathon.csv
|
251
|
+
|
252
|
+
ruby /devtools/workspace/RF_Gooby/bin/gooby_parser.rb garmin205 km /devtools/workspace/RF_Gooby/data/20070505_davidson_5k.xml > /devtools/workspace/RF_Gooby/data/20070505_davidson_5k_km.csv
|
177
253
|
|
178
254
|
ruby:
|
179
255
|
|
@@ -185,14 +261,62 @@ Function 2 - Garmin XML/TCX file parsing:
|
|
185
261
|
|
186
262
|
gooby = Gooby::GoobyCommand.new(config_filename)
|
187
263
|
gooby.parse_garmin_xml_file(ARGV)
|
188
|
-
|
189
264
|
|
190
|
-
|
265
|
+
|
266
|
+
Function 5 - CSV File Validation
|
267
|
+
--------------------------------
|
268
|
+
shell:
|
269
|
+
|
270
|
+
ruby /devtools/workspace/RF_Gooby/bin/gooby_csv_validation.rb
|
271
|
+
|
272
|
+
ruby:
|
273
|
+
|
274
|
+
require 'rubygems'
|
275
|
+
require 'gooby'
|
276
|
+
include REXML
|
277
|
+
|
278
|
+
config_filename = '/devtools/workspace/RF_Gooby/config/gooby_config.yaml'
|
279
|
+
|
280
|
+
full_files = false
|
281
|
+
|
282
|
+
list = Array.new
|
283
|
+
list << '/devtools/workspace/RF_Gooby/data/hrm1.csv'
|
284
|
+
list << '/devtools/workspace/RF_Gooby/data/20050305_corporate_cup_hm.csv'
|
285
|
+
list << '/devtools/workspace/RF_Gooby/data/20050430_nashville_marathon_km.csv'
|
286
|
+
list << '/devtools/workspace/RF_Gooby/data/20060115_phoenix_marathon.csv'
|
287
|
+
list << '/devtools/workspace/RF_Gooby/data/20070101_davidson_11m.csv'
|
288
|
+
list << '/devtools/workspace/RF_Gooby/data/20070505_davidson_5k_km.csv'
|
289
|
+
|
290
|
+
list << '/devtools/workspace/RF_Gooby/data/2007_g201.csv' if full_files
|
291
|
+
list << '/devtools/workspace/RF_Gooby/data/2007_g205.csv' if full_files
|
292
|
+
list << '/devtools/workspace/RF_Gooby/data/2007_g305.csv' if full_files
|
293
|
+
|
294
|
+
gooby = Gooby::GoobyCommand.new(config_filename)
|
295
|
+
@csv_points = gooby.read_csv_files(list)
|
296
|
+
@csv_col_names = gooby.csv_col_names
|
297
|
+
|
298
|
+
puts "#{@csv_points.size} points read from csv file(s)."
|
299
|
+
puts "#{@csv_col_names.size} fields per line."
|
300
|
+
|
301
|
+
index = 0
|
302
|
+
@csv_col_names.each {|col_name|
|
303
|
+
puts sprintf("-- %s %2s [%s]", col_name.ljust(16), index, @csv_points[-1].tokens[index])
|
304
|
+
index = index + 1
|
305
|
+
}
|
306
|
+
|
307
|
+
@csv_points.each {|csv_point|
|
308
|
+
puts csv_point.rawdata if csv_point.token_count != 15
|
309
|
+
}
|
310
|
+
|
311
|
+
|
312
|
+
Function 6 - "been_there":
|
191
313
|
--------------------------
|
192
314
|
shell:
|
193
315
|
|
194
316
|
ruby /devtools/workspace/RF_Gooby/bin/gooby_been_there.rb > /devtools/workspace/RF_Gooby/samples/been_there.txt
|
195
317
|
|
318
|
+
ruby /devtools/workspace/RF_Gooby/bin/gooby_been_there.rb
|
319
|
+
|
196
320
|
ruby:
|
197
321
|
|
198
322
|
require 'rubygems'
|
@@ -204,14 +328,10 @@ Function 3 - "been_there":
|
|
204
328
|
gooby = Gooby::GoobyCommand.new(config_filename)
|
205
329
|
|
206
330
|
# first read the csv file(s) parsed from your Garmin export tcx/xml files.
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
# read_csv_files has an optional second arg to display the specified formatted record number (i.e. - (csv_list,3) ).
|
212
|
-
gooby.read_csv_files(csv_list, 3)
|
213
|
-
|
214
|
-
gooby.been_there('333', 0.0025) # course 333 doesn't exist
|
331
|
+
list = Array.new
|
332
|
+
list << '/devtools/workspace/RF_Gooby/data/20070101_davidson_11m.csv'
|
333
|
+
list << '/devtools/workspace/RF_Gooby/data/hrm1.csv'
|
334
|
+
gooby.read_csv_files(list)
|
215
335
|
|
216
336
|
# first arg to 'been_there' is the course number, second arg is the 'proximity' specified as
|
217
337
|
# 'degrees difference'. Degrees difference is defined as the absolute value of lat1 - lat2,
|
@@ -220,18 +340,16 @@ Function 3 - "been_there":
|
|
220
340
|
|
221
341
|
gooby.been_there('1', 0.0025)
|
222
342
|
gooby.been_there('2', 0.0025)
|
223
|
-
gooby.been_there('
|
224
|
-
gooby.been_there('4', 0.0025)
|
225
|
-
gooby.been_there('10', 0.0025)
|
343
|
+
gooby.been_there('999', 0.0005)
|
226
344
|
|
227
345
|
|
228
|
-
Function
|
346
|
+
Function 7 - Google Map Generation:
|
229
347
|
-----------------------------------
|
230
|
-
|
231
348
|
shell:
|
232
349
|
|
233
|
-
ruby /devtools/workspace/RF_Gooby/bin/gooby_gen_gmap.rb /devtools/workspace/RF_Gooby/data/
|
234
|
-
|
350
|
+
ruby /devtools/workspace/RF_Gooby/bin/gooby_gen_gmap.rb /devtools/workspace/RF_Gooby/data/20060115_phoenix_marathon.csv > /devtools/workspace/RF_Gooby/samples/20060115_phoenix_marathon.html
|
351
|
+
|
352
|
+
ruby /devtools/workspace/RF_Gooby/bin/gooby_gen_gmap.rb /devtools/workspace/RF_Gooby/data/20070505_davidson_5k_km.csv > /devtools/workspace/RF_Gooby/samples/20070505_davidson_5k.html
|
235
353
|
|
236
354
|
ruby:
|
237
355
|
|
@@ -245,6 +363,53 @@ Function 4 - Google Map Generation:
|
|
245
363
|
gooby.generate_google_map(ARGV)
|
246
364
|
|
247
365
|
|
366
|
+
Note: The input file passed to the Google Map generation process is the CSV file, not the Garmin XML file.
|
367
|
+
|
368
|
+
|
369
|
+
Function 8 - Extract First Trackpoints as (potential) Points-of-Interest (POI)
|
370
|
+
------------------------------------------------------------------------------
|
371
|
+
shell:
|
372
|
+
|
373
|
+
ruby /devtools/workspace/RF_Gooby/bin/gooby_first_trackpoints_as_poi.rb
|
374
|
+
|
375
|
+
ruby:
|
376
|
+
|
377
|
+
require 'rubygems'
|
378
|
+
require 'gooby'
|
379
|
+
include REXML
|
380
|
+
|
381
|
+
config_filename = '/devtools/workspace/RF_Gooby/config/gooby_config.yaml'
|
382
|
+
|
383
|
+
gooby = Gooby::GoobyCommand.new(config_filename)
|
384
|
+
|
385
|
+
# first read the csv file(s) parsed from your Garmin export tcx/xml files.
|
386
|
+
list = Array.new
|
387
|
+
list << '/devtools/workspace/RF_Gooby/data/hrm1.csv'
|
388
|
+
list << '/devtools/workspace/RF_Gooby/data/20050305_corporate_cup_hm.csv'
|
389
|
+
list << '/devtools/workspace/RF_Gooby/data/20050430_nashville_marathon_km.csv'
|
390
|
+
list << '/devtools/workspace/RF_Gooby/data/20060115_phoenix_marathon.csv'
|
391
|
+
list << '/devtools/workspace/RF_Gooby/data/20070101_davidson_11m.csv'
|
392
|
+
list << '/devtools/workspace/RF_Gooby/data/20070505_davidson_5k_km.csv'
|
393
|
+
gooby.read_csv_files(list)
|
394
|
+
|
395
|
+
# optional first arg is the date of the run, otherwise the all dates.
|
396
|
+
gooby.first_trackpoints_as_poi(ARGV[0])
|
397
|
+
|
398
|
+
|
399
|
+
Function 9 - Create a MySQL database table for your parsed CSV data
|
400
|
+
-------------------------------------------------------------------
|
401
|
+
shell:
|
402
|
+
|
403
|
+
/usr/local/mysql/bin/mysql < /devtools/workspace/RF_Gooby/sql/gooby.ddl -u <your_db_id> -p
|
404
|
+
|
405
|
+
|
406
|
+
Function 10 - Populate the MySQL database table with your parsed CSV data
|
407
|
+
-------------------------------------------------------------------------
|
408
|
+
shell:
|
409
|
+
|
410
|
+
/usr/local/mysql/bin/mysql < /devtools/workspace/RF_Gooby/sql/gooby_load.dml -u <your_db_id> -p
|
411
|
+
|
412
|
+
|
248
413
|
== Warranty
|
249
414
|
|
250
415
|
This software is provided "as is" and without any express or implied warranties,
|
data/bin/code_scan.rb
CHANGED
@@ -1,11 +1,9 @@
|
|
1
1
|
=begin
|
2
2
|
|
3
|
+
Gooby = Google APIs + Ruby
|
3
4
|
Gooby - Copyright 2007 by Chris Joakim.
|
4
5
|
Gooby is available under GNU General Public License (GPL) license.
|
5
6
|
|
6
|
-
Example command line:
|
7
|
-
ruby bin/code_scan.rb
|
8
|
-
|
9
7
|
=end
|
10
8
|
|
11
9
|
# The following prefixes ../lib to the active ruby load path
|
data/bin/gooby_been_there.rb
CHANGED
@@ -1,10 +1,14 @@
|
|
1
|
+
=begin
|
2
|
+
|
3
|
+
Gooby = Google APIs + Ruby
|
4
|
+
Gooby - Copyright 2007 by Chris Joakim.
|
5
|
+
Gooby is available under GNU General Public License (GPL) license.
|
6
|
+
|
7
|
+
=end
|
1
8
|
|
2
9
|
# The following prefixes ../lib to the active ruby load path
|
3
10
|
$:.unshift File.join(File.dirname(__FILE__), "..", "lib")
|
4
11
|
|
5
|
-
# Example usage:
|
6
|
-
# ruby bin/gooby_been_there.rb > been_there.txt
|
7
|
-
|
8
12
|
require 'rubygems'
|
9
13
|
require 'gooby'
|
10
14
|
include REXML
|
@@ -14,14 +18,10 @@ config_filename = '/devtools/workspace/RF_Gooby/config/gooby_config.yaml'
|
|
14
18
|
gooby = Gooby::GoobyCommand.new(config_filename)
|
15
19
|
|
16
20
|
# first read the csv file(s) parsed from your Garmin export tcx/xml files.
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
# read_csv_files has an optional second arg to display the specified formatted record number (i.e. - (csv_list,3) ).
|
22
|
-
gooby.read_csv_files(csv_list, 3)
|
23
|
-
|
24
|
-
gooby.been_there('333', 0.0025) # course 333 doesn't exist
|
21
|
+
list = Array.new
|
22
|
+
list << '/devtools/workspace/RF_Gooby/data/20070101_davidson_11m.csv'
|
23
|
+
list << '/devtools/workspace/RF_Gooby/data/hrm1.csv'
|
24
|
+
gooby.read_csv_files(list)
|
25
25
|
|
26
26
|
# first arg to 'been_there' is the course number, second arg is the 'proximity' specified as
|
27
27
|
# 'degrees difference'. Degrees difference is defined as the absolute value of lat1 - lat2,
|
@@ -30,6 +30,4 @@ gooby.been_there('333', 0.0025) # course 333 doesn't exist
|
|
30
30
|
|
31
31
|
gooby.been_there('1', 0.0025)
|
32
32
|
gooby.been_there('2', 0.0025)
|
33
|
-
gooby.been_there('
|
34
|
-
gooby.been_there('4', 0.0025)
|
35
|
-
gooby.been_there('10', 0.0025)
|
33
|
+
gooby.been_there('999', 0.0005)
|
data/bin/gooby_config.rb
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
=begin
|
2
|
+
|
3
|
+
Gooby = Google APIs + Ruby
|
4
|
+
Gooby - Copyright 2007 by Chris Joakim.
|
5
|
+
Gooby is available under GNU General Public License (GPL) license.
|
6
|
+
|
7
|
+
=end
|
1
8
|
|
2
9
|
# The following prefixes ../lib to the active ruby load path
|
3
10
|
$:.unshift File.join(File.dirname(__FILE__), "..", "lib")
|
@@ -9,8 +16,9 @@ include REXML
|
|
9
16
|
config_filename = '/devtools/workspace/RF_Gooby/config/gooby_config.yaml'
|
10
17
|
|
11
18
|
gooby = Gooby::GoobyCommand.new(config_filename)
|
12
|
-
|
13
|
-
|
14
|
-
gooby.configuration.
|
19
|
+
gooby.display_configuration
|
20
|
+
|
21
|
+
#puts gooby.configuration.get_poi('1')
|
22
|
+
#gooby.configuration.get_course('2').dump
|
15
23
|
|
16
24
|
|
@@ -0,0 +1,50 @@
|
|
1
|
+
=begin
|
2
|
+
|
3
|
+
Gooby = Google APIs + Ruby
|
4
|
+
Gooby - Copyright 2007 by Chris Joakim.
|
5
|
+
Gooby is available under GNU General Public License (GPL) license.
|
6
|
+
|
7
|
+
=end
|
8
|
+
|
9
|
+
# The following prefixes ../lib to the active ruby load path
|
10
|
+
$:.unshift File.join(File.dirname(__FILE__), "..", "lib")
|
11
|
+
|
12
|
+
require 'rubygems'
|
13
|
+
require 'gooby'
|
14
|
+
include REXML
|
15
|
+
|
16
|
+
config_filename = '/devtools/workspace/RF_Gooby/config/gooby_config.yaml'
|
17
|
+
|
18
|
+
full_files = false
|
19
|
+
|
20
|
+
list = Array.new
|
21
|
+
list << '/devtools/workspace/RF_Gooby/data/hrm1.csv'
|
22
|
+
list << '/devtools/workspace/RF_Gooby/data/20050305_corporate_cup_hm.csv'
|
23
|
+
list << '/devtools/workspace/RF_Gooby/data/20050430_nashville_marathon_km.csv'
|
24
|
+
list << '/devtools/workspace/RF_Gooby/data/20060115_phoenix_marathon.csv'
|
25
|
+
list << '/devtools/workspace/RF_Gooby/data/20070101_davidson_11m.csv'
|
26
|
+
list << '/devtools/workspace/RF_Gooby/data/20070505_davidson_5k_km.csv'
|
27
|
+
|
28
|
+
list << '/devtools/workspace/RF_Gooby/data/2007_g201.csv' if full_files
|
29
|
+
list << '/devtools/workspace/RF_Gooby/data/2007_g205.csv' if full_files
|
30
|
+
list << '/devtools/workspace/RF_Gooby/data/2007_g305.csv' if full_files
|
31
|
+
|
32
|
+
gooby = Gooby::GoobyCommand.new(config_filename)
|
33
|
+
@csv_points = gooby.read_csv_files(list)
|
34
|
+
@csv_col_names = gooby.csv_col_names
|
35
|
+
|
36
|
+
puts "#{@csv_points.size} points read from csv file(s)."
|
37
|
+
puts "#{@csv_col_names.size} fields per line."
|
38
|
+
|
39
|
+
index = 0
|
40
|
+
@csv_col_names.each {|col_name|
|
41
|
+
puts sprintf("-- %s %2s [%s]", col_name.ljust(16), index, @csv_points[-1].tokens[index])
|
42
|
+
index = index + 1
|
43
|
+
}
|
44
|
+
|
45
|
+
@csv_points.each {|csv_point|
|
46
|
+
puts csv_point.rawdata if csv_point.token_count != 15
|
47
|
+
}
|
48
|
+
|
49
|
+
|
50
|
+
|