tf1_converter 0.8.0 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- tf1_converter (0.8.0)
4
+ tf1_converter (0.9.0)
5
5
  builder (= 3.1.4)
6
6
  geo_swap (= 0.2.1)
7
7
  nokogiri (= 1.5.6)
@@ -10,12 +10,6 @@ The full path of the directory where your icons are stored
10
10
  ICON_PATH
11
11
  /Users/ethanvizitei/icons
12
12
 
13
- START_PATH
14
- c:\program files\gpx2kml\test
15
-
16
- END_PATH
17
- c:\program files\gpx2kml\test
18
-
19
13
  Table of Icons (symbol/filename/meaning/custom_name)
20
14
  ICONS
21
15
  Custom 0,01.png,Search Start,icon_name_1
@@ -10,12 +10,6 @@ The full path of the directory where your icons are stored
10
10
  ICON_PATH
11
11
  c:\program files\gpx2kml\icon\tf_ge\
12
12
 
13
- START_PATH
14
- c:\program files\gpx2kml\test
15
-
16
- END_PATH
17
- c:\program files\gpx2kml\test
18
-
19
13
  Table of Icons (symbol/filename/meaning/custom_name)
20
14
  ICONS
21
15
  Custom 0,01.png,Search Start,icon_name_1
@@ -52,4 +46,4 @@ Red,f01400ff
52
46
  Orange,f014b4ff
53
47
  Green,f000b414
54
48
  Purple,f0ff7878
55
- Pink,f0ff78f0
49
+ Pink,f0ff78f0
@@ -13,10 +13,6 @@ module TF1Converter
13
13
  @output = row[0]
14
14
  elsif last_key == 'ICON_PATH'
15
15
  @icon_path = row[0]
16
- elsif last_key == 'START_PATH'
17
- @start_path = row[0]
18
- elsif last_key == 'END_PATH'
19
- @end_path = row[0]
20
16
  elsif last_key == 'ICONS'
21
17
  @icons = {}
22
18
  current_control = 'ICONS'
@@ -47,7 +43,7 @@ module TF1Converter
47
43
  end
48
44
  end
49
45
 
50
- %w(icon_path start_path end_path icons colors input output).each do |name|
46
+ %w(icon_path icons colors input output).each do |name|
51
47
  define_singleton_method(name.to_sym) do
52
48
  instance_variable_get("@#{name}")
53
49
  end
@@ -9,9 +9,9 @@ module TF1Converter
9
9
 
10
10
  def to_csv!
11
11
  CSV.open(@path, 'wb') do |csv|
12
- csv << ['filename', 'name', 'meaning', 'time', 'lat', 'long', 'usng', 'utm']
12
+ csv << ['filename', 'name', 'meaning', 'time', 'lat', 'long', 'usng', 'elevation']
13
13
  @waypoints.each do |wp|
14
- csv << [@path.split('.').first, wp.name, wp.icon_meaning, wp.timestamp, wp.lat, wp.long, wp.usng, wp.utm]
14
+ csv << [@path.split('.').first, wp.name, wp.icon_meaning, wp.timestamp, wp.lat, wp.long, wp.usng, wp.elevation]
15
15
  end
16
16
  end
17
17
  end
@@ -43,6 +43,10 @@ module TF1Converter
43
43
  @node.attribute('lon').value
44
44
  end
45
45
 
46
+ def elevation
47
+ @node.children.select{ |child| child.name == 'ele' }.first.text
48
+ end
49
+
46
50
  def usng
47
51
  u = utm_object
48
52
  GeoSwap.utm_to_usng(u.easting, u.northing, u.zone.number, u.zone.letter)
@@ -1,8 +1,9 @@
1
1
  module TF1Converter
2
2
  class KmlFile
3
- def initialize(waypoints, tracks)
3
+ def initialize(waypoints, tracks, filename)
4
4
  @waypoints = waypoints
5
5
  @tracks = tracks
6
+ @filename = filename
6
7
  end
7
8
 
8
9
  def to_xml
@@ -75,7 +76,7 @@ module TF1Converter
75
76
  xml.Placemark(id: track.name) do
76
77
  xml.name track.name
77
78
  xml.description do
78
- xml.cdata "KML file, track, and waypoint comment."
79
+ xml.cdata @filename
79
80
  end
80
81
  xml.styleUrl "##{track.name}_Style"
81
82
  xml.LineString do
@@ -92,11 +93,10 @@ module TF1Converter
92
93
  desc = ""
93
94
  desc << waypoint.timestamp
94
95
  desc << '<br>' << waypoint.icon_meaning
95
- desc << '<br>' << "KML file, track, and waypoint comment."
96
+ desc << '<br>' << "Filename: #{@filename}"
96
97
  desc << "<br>" << "USNG: #{waypoint.usng}"
97
- desc << "<br>" << "UTM: #{waypoint.utm}"
98
- desc << "<br>" << "Lat/Long: #{waypoint.lat}/#{waypoint.long}"
99
- desc << "<br>" << "#{Config.start_path} - #{Config.end_path}"
98
+ desc << "<br>" << "Lat,Long: #{waypoint.lat},#{waypoint.long}"
99
+ desc << "<br>" << "Elevation: #{waypoint.elevation}"
100
100
  end
101
101
 
102
102
  def next_color
@@ -12,6 +12,7 @@ module TF1Converter
12
12
  end
13
13
 
14
14
  def initialize(gpx_file)
15
+ @filename = File.basename(gpx_file.path).split('.').first
15
16
  parsed_gpx = Nokogiri::XML(gpx_file)
16
17
  parsed_gpx.remove_namespaces!
17
18
  @gpx = GpxFile.new(parsed_gpx)
@@ -22,7 +23,7 @@ module TF1Converter
22
23
  csv_path = raw_file_name + '.csv'
23
24
  CsvFile.new(@gpx.waypoints, csv_path).to_csv!
24
25
 
25
- kml = KmlFile.new(@gpx.waypoints, @gpx.tracks).to_xml
26
+ kml = KmlFile.new(@gpx.waypoints, @gpx.tracks, @filename).to_xml
26
27
  output_file.puts kml
27
28
  output_file.close
28
29
 
@@ -1,3 +1,3 @@
1
1
  module TF1Converter
2
- VERSION = "0.8.0"
2
+ VERSION = "0.9.0"
3
3
  end
@@ -21,7 +21,7 @@
21
21
  </Icon>
22
22
  </IconStyle>
23
23
  </Style>
24
- <description><![CDATA[18-OCT-09 2:17:38PM<br>Search Start<br>KML file, track, and waypoint comment.<br>USNG: 15S WD 60922 8133<br>UTM: 15S 560922mE 4308133mN<br>Lat/Long: 38.9199972/-92.2972443<br>c:\program files\gpx2kml\test - c:\program files\gpx2kml\test]]></description>
24
+ <description><![CDATA[18-OCT-09 2:17:38PM<br>Search Start<br>Filename: test<br>USNG: 15S WD 60922 8133<br>Lat,Long: 38.9199972,-92.2972443<br>Elevation: 159.7036133]]></description>
25
25
  <Point>
26
26
  <coordinates>-92.2972443,38.9199972</coordinates>
27
27
  </Point>
@@ -36,7 +36,7 @@
36
36
  </Icon>
37
37
  </IconStyle>
38
38
  </Style>
39
- <description><![CDATA[18-OCT-09 2:18:07PM<br>Victim Detected<br>KML file, track, and waypoint comment.<br>USNG: 15S WD 60946 8109<br>UTM: 15S 560946mE 4308109mN<br>Lat/Long: 38.9197762/-92.2969611<br>c:\program files\gpx2kml\test - c:\program files\gpx2kml\test]]></description>
39
+ <description><![CDATA[18-OCT-09 2:18:07PM<br>Victim Detected<br>Filename: test<br>USNG: 15S WD 60946 8109<br>Lat,Long: 38.9197762,-92.2969611<br>Elevation: 206.8077393]]></description>
40
40
  <Point>
41
41
  <coordinates>-92.2969611,38.9197762</coordinates>
42
42
  </Point>
@@ -51,7 +51,7 @@
51
51
  </Icon>
52
52
  </IconStyle>
53
53
  </Style>
54
- <description><![CDATA[18-OCT-09 2:18:36PM<br>Victim Confirmed<br>KML file, track, and waypoint comment.<br>USNG: 15S WD 60928 8079<br>UTM: 15S 560928mE 4308079mN<br>Lat/Long: 38.9195040/-92.2971813<br>c:\program files\gpx2kml\test - c:\program files\gpx2kml\test]]></description>
54
+ <description><![CDATA[18-OCT-09 2:18:36PM<br>Victim Confirmed<br>Filename: test<br>USNG: 15S WD 60928 8079<br>Lat,Long: 38.9195040,-92.2971813<br>Elevation: 228.6776123]]></description>
55
55
  <Point>
56
56
  <coordinates>-92.2971813,38.9195040</coordinates>
57
57
  </Point>
@@ -66,7 +66,7 @@
66
66
  </Icon>
67
67
  </IconStyle>
68
68
  </Style>
69
- <description><![CDATA[18-OCT-09 2:19:49PM<br>Collection Point<br>KML file, track, and waypoint comment.<br>USNG: 15S WD 60883 8039<br>UTM: 15S 560883mE 4308039mN<br>Lat/Long: 38.9191455/-92.2977024<br>c:\program files\gpx2kml\test - c:\program files\gpx2kml\test]]></description>
69
+ <description><![CDATA[18-OCT-09 2:19:49PM<br>Collection Point<br>Filename: test<br>USNG: 15S WD 60883 8039<br>Lat,Long: 38.9191455,-92.2977024<br>Elevation: 230.8405762]]></description>
70
70
  <Point>
71
71
  <coordinates>-92.2977024,38.9191455</coordinates>
72
72
  </Point>
@@ -81,7 +81,7 @@
81
81
  </Icon>
82
82
  </IconStyle>
83
83
  </Style>
84
- <description><![CDATA[18-OCT-09 2:20:33PM<br>Structure Damage / Safe<br>KML file, track, and waypoint comment.<br>USNG: 15S WD 60912 8043<br>UTM: 15S 560912mE 4308043mN<br>Lat/Long: 38.9191831/-92.2973642<br>c:\program files\gpx2kml\test - c:\program files\gpx2kml\test]]></description>
84
+ <description><![CDATA[18-OCT-09 2:20:33PM<br>Structure Damage / Safe<br>Filename: test<br>USNG: 15S WD 60912 8043<br>Lat,Long: 38.9191831,-92.2973642<br>Elevation: 234.6857910]]></description>
85
85
  <Point>
86
86
  <coordinates>-92.2973642,38.9191831</coordinates>
87
87
  </Point>
@@ -96,7 +96,7 @@
96
96
  </Icon>
97
97
  </IconStyle>
98
98
  </Style>
99
- <description><![CDATA[18-OCT-09 2:21:40PM<br>Criminal Activity<br>KML file, track, and waypoint comment.<br>USNG: 15S WD 60966 8093<br>UTM: 15S 560966mE 4308093mN<br>Lat/Long: 38.9196337/-92.2967348<br>c:\program files\gpx2kml\test - c:\program files\gpx2kml\test]]></description>
99
+ <description><![CDATA[18-OCT-09 2:21:40PM<br>Criminal Activity<br>Filename: test<br>USNG: 15S WD 60966 8093<br>Lat,Long: 38.9196337,-92.2967348<br>Elevation: 237.3294678]]></description>
100
100
  <Point>
101
101
  <coordinates>-92.2967348,38.9196337</coordinates>
102
102
  </Point>
@@ -111,7 +111,7 @@
111
111
  </Icon>
112
112
  </IconStyle>
113
113
  </Style>
114
- <description><![CDATA[18-OCT-09 2:22:29PM<br>Command Post<br>KML file, track, and waypoint comment.<br>USNG: 15S WD 61002 8066<br>UTM: 15S 561002mE 4308066mN<br>Lat/Long: 38.9193832/-92.2963225<br>c:\program files\gpx2kml\test - c:\program files\gpx2kml\test]]></description>
114
+ <description><![CDATA[18-OCT-09 2:22:29PM<br>Command Post<br>Filename: test<br>USNG: 15S WD 61002 8066<br>Lat,Long: 38.9193832,-92.2963225<br>Elevation: 239.7326660]]></description>
115
115
  <Point>
116
116
  <coordinates>-92.2963225,38.9193832</coordinates>
117
117
  </Point>
@@ -126,7 +126,7 @@
126
126
  </Icon>
127
127
  </IconStyle>
128
128
  </Style>
129
- <description><![CDATA[18-OCT-09 2:23:14PM<br>Staging Area<br>KML file, track, and waypoint comment.<br>USNG: 15S WD 61033 8055<br>UTM: 15S 561033mE 4308055mN<br>Lat/Long: 38.9192829/-92.2959630<br>c:\program files\gpx2kml\test - c:\program files\gpx2kml\test]]></description>
129
+ <description><![CDATA[18-OCT-09 2:23:14PM<br>Staging Area<br>Filename: test<br>USNG: 15S WD 61033 8055<br>Lat,Long: 38.9192829,-92.2959630<br>Elevation: 239.9730225]]></description>
130
130
  <Point>
131
131
  <coordinates>-92.2959630,38.9192829</coordinates>
132
132
  </Point>
@@ -141,7 +141,7 @@
141
141
  </Icon>
142
142
  </IconStyle>
143
143
  </Style>
144
- <description><![CDATA[18-OCT-09 2:24:06PM<br>Meaning 19<br>KML file, track, and waypoint comment.<br>USNG: 15S WD 60985 8098<br>UTM: 15S 560985mE 4308098mN<br>Lat/Long: 38.9196773/-92.2965171<br>c:\program files\gpx2kml\test - c:\program files\gpx2kml\test]]></description>
144
+ <description><![CDATA[18-OCT-09 2:24:06PM<br>Meaning 19<br>Filename: test<br>USNG: 15S WD 60985 8098<br>Lat,Long: 38.9196773,-92.2965171<br>Elevation: 238.5311279]]></description>
145
145
  <Point>
146
146
  <coordinates>-92.2965171,38.9196773</coordinates>
147
147
  </Point>
@@ -156,7 +156,7 @@
156
156
  </Icon>
157
157
  </IconStyle>
158
158
  </Style>
159
- <description><![CDATA[18-OCT-09 2:25:24PM<br>Meaning 16<br>KML file, track, and waypoint comment.<br>USNG: 15S WD 60909 8156<br>UTM: 15S 560909mE 4308156mN<br>Lat/Long: 38.9202020/-92.2973907<br>c:\program files\gpx2kml\test - c:\program files\gpx2kml\test]]></description>
159
+ <description><![CDATA[18-OCT-09 2:25:24PM<br>Meaning 16<br>Filename: test<br>USNG: 15S WD 60909 8156<br>Lat,Long: 38.9202020,-92.2973907<br>Elevation: 237.5697021]]></description>
160
160
  <Point>
161
161
  <coordinates>-92.2973907,38.9202020</coordinates>
162
162
  </Point>
@@ -171,7 +171,7 @@
171
171
  </Icon>
172
172
  </IconStyle>
173
173
  </Style>
174
- <description><![CDATA[18-OCT-09 2:26:20PM<br>Extra 21<br>KML file, track, and waypoint comment.<br>USNG: 15S WD 60918 8213<br>UTM: 15S 560918mE 4308213mN<br>Lat/Long: 38.9207150/-92.2972759<br>c:\program files\gpx2kml\test - c:\program files\gpx2kml\test]]></description>
174
+ <description><![CDATA[18-OCT-09 2:26:20PM<br>Extra 21<br>Filename: test<br>USNG: 15S WD 60918 8213<br>Lat,Long: 38.9207150,-92.2972759<br>Elevation: 236.1278076]]></description>
175
175
  <Point>
176
176
  <coordinates>-92.2972759,38.9207150</coordinates>
177
177
  </Point>
@@ -186,7 +186,7 @@
186
186
  </Icon>
187
187
  </IconStyle>
188
188
  </Style>
189
- <description><![CDATA[18-OCT-09 2:26:40PM<br>Extra 22<br>KML file, track, and waypoint comment.<br>USNG: 15S WD 60902 8223<br>UTM: 15S 560902mE 4308223mN<br>Lat/Long: 38.9208083/-92.2974574<br>c:\program files\gpx2kml\test - c:\program files\gpx2kml\test]]></description>
189
+ <description><![CDATA[18-OCT-09 2:26:40PM<br>Extra 22<br>Filename: test<br>USNG: 15S WD 60902 8223<br>Lat,Long: 38.9208083,-92.2974574<br>Elevation: 234.9260254]]></description>
190
190
  <Point>
191
191
  <coordinates>-92.2974574,38.9208083</coordinates>
192
192
  </Point>
@@ -201,7 +201,7 @@
201
201
  </Icon>
202
202
  </IconStyle>
203
203
  </Style>
204
- <description><![CDATA[18-OCT-09 2:27:10PM<br>Extra 23<br>KML file, track, and waypoint comment.<br>USNG: 15S WD 60880 8191<br>UTM: 15S 560880mE 4308191mN<br>Lat/Long: 38.9205154/-92.2977240<br>c:\program files\gpx2kml\test - c:\program files\gpx2kml\test]]></description>
204
+ <description><![CDATA[18-OCT-09 2:27:10PM<br>Extra 23<br>Filename: test<br>USNG: 15S WD 60880 8191<br>Lat,Long: 38.9205154,-92.2977240<br>Elevation: 235.6469727]]></description>
205
205
  <Point>
206
206
  <coordinates>-92.2977240,38.9205154</coordinates>
207
207
  </Point>
@@ -216,7 +216,7 @@
216
216
  </Icon>
217
217
  </IconStyle>
218
218
  </Style>
219
- <description><![CDATA[18-OCT-09 2:29:16PM<br>Search Stop<br>KML file, track, and waypoint comment.<br>USNG: 15S WD 60822 8145<br>UTM: 15S 560822mE 4308145mN<br>Lat/Long: 38.9201116/-92.2983951<br>c:\program files\gpx2kml\test - c:\program files\gpx2kml\test]]></description>
219
+ <description><![CDATA[18-OCT-09 2:29:16PM<br>Search Stop<br>Filename: test<br>USNG: 15S WD 60822 8145<br>Lat,Long: 38.9201116,-92.2983951<br>Elevation: 234.6857910]]></description>
220
220
  <Point>
221
221
  <coordinates>-92.2983951,38.9201116</coordinates>
222
222
  </Point>
@@ -231,7 +231,7 @@
231
231
  </Icon>
232
232
  </IconStyle>
233
233
  </Style>
234
- <description><![CDATA[Weber Home<br>Default<br>KML file, track, and waypoint comment.<br>USNG: 15S WD 60826 8138<br>UTM: 15S 560826mE 4308138mN<br>Lat/Long: 38.9200473/-92.2983507<br>c:\program files\gpx2kml\test - c:\program files\gpx2kml\test]]></description>
234
+ <description><![CDATA[Weber Home<br>Default<br>Filename: test<br>USNG: 15S WD 60826 8138<br>Lat,Long: 38.9200473,-92.2983507<br>Elevation: 235.8873291]]></description>
235
235
  <Point>
236
236
  <coordinates>-92.2983507,38.9200473</coordinates>
237
237
  </Point>
@@ -247,7 +247,7 @@
247
247
  </Style>
248
248
  <Placemark id="18-OCT-09">
249
249
  <name>18-OCT-09</name>
250
- <description><![CDATA[KML file, track, and waypoint comment.]]></description>
250
+ <description><![CDATA[test]]></description>
251
251
  <styleUrl>#18-OCT-09_Style</styleUrl>
252
252
  <LineString>
253
253
  <extrude>1</extrude>
@@ -264,7 +264,7 @@
264
264
  </Style>
265
265
  <Placemark id="ACTIVE LOG 001">
266
266
  <name>ACTIVE LOG 001</name>
267
- <description><![CDATA[KML file, track, and waypoint comment.]]></description>
267
+ <description><![CDATA[test]]></description>
268
268
  <styleUrl>#ACTIVE LOG 001_Style</styleUrl>
269
269
  <LineString>
270
270
  <extrude>1</extrude>
@@ -281,7 +281,7 @@
281
281
  </Style>
282
282
  <Placemark id="ACTIVE LOG 002">
283
283
  <name>ACTIVE LOG 002</name>
284
- <description><![CDATA[KML file, track, and waypoint comment.]]></description>
284
+ <description><![CDATA[test]]></description>
285
285
  <styleUrl>#ACTIVE LOG 002_Style</styleUrl>
286
286
  <LineString>
287
287
  <extrude>1</extrude>
@@ -298,7 +298,7 @@
298
298
  </Style>
299
299
  <Placemark id="ACTIVE LOG 003">
300
300
  <name>ACTIVE LOG 003</name>
301
- <description><![CDATA[KML file, track, and waypoint comment.]]></description>
301
+ <description><![CDATA[test]]></description>
302
302
  <styleUrl>#ACTIVE LOG 003_Style</styleUrl>
303
303
  <LineString>
304
304
  <extrude>1</extrude>
@@ -315,7 +315,7 @@
315
315
  </Style>
316
316
  <Placemark id="ACTIVE LOG 004">
317
317
  <name>ACTIVE LOG 004</name>
318
- <description><![CDATA[KML file, track, and waypoint comment.]]></description>
318
+ <description><![CDATA[test]]></description>
319
319
  <styleUrl>#ACTIVE LOG 004_Style</styleUrl>
320
320
  <LineString>
321
321
  <extrude>1</extrude>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tf1_converter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-23 00:00:00.000000000 Z
12
+ date: 2013-03-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
@@ -209,7 +209,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
209
209
  version: '0'
210
210
  segments:
211
211
  - 0
212
- hash: 4209753862733167142
212
+ hash: -3726105002233620778
213
213
  required_rubygems_version: !ruby/object:Gem::Requirement
214
214
  none: false
215
215
  requirements:
@@ -218,7 +218,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
218
218
  version: '0'
219
219
  segments:
220
220
  - 0
221
- hash: 4209753862733167142
221
+ hash: -3726105002233620778
222
222
  requirements: []
223
223
  rubyforge_project:
224
224
  rubygems_version: 1.8.23