tf1_converter 0.1.2 → 0.2.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/Gemfile.lock +3 -1
- data/bin/tf1convert +10 -3
- data/example/config.yml +24 -24
- data/example/windowsconfig.yml +32 -0
- data/lib/tf1_converter/translation.rb +5 -4
- data/lib/tf1_converter/version.rb +2 -2
- data/lib/tf1_converter.rb +0 -1
- data/output/test.kml +44 -44
- data/spec/fixtures/expected.kml +329 -0
- data/spec/fixtures/test.kml +329 -25
- data/spec/lib/tf1_converter/translation_spec.rb +22 -0
- data/tf1_converter.gemspec +1 -0
- metadata +24 -6
- data/lib/tf1_converter/waypoint.rb +0 -48
- data/spec/waypoint_spec.rb +0 -34
data/spec/fixtures/test.kml
CHANGED
@@ -1,25 +1,329 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"
|
2
|
-
<
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
<
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
+
<kml xmlns="http://www.opengis.net/kml/2.2">
|
3
|
+
<Document>
|
4
|
+
<open>1</open>
|
5
|
+
<Snippet maxLines="1"/>
|
6
|
+
<description><![CDATA[09-01-2008 12:00:00 PM<br/><br/>TF1 Converter Version 1.0<br/>MO Task Force 1<br/>]]></description>
|
7
|
+
<Style id="sn_noicon">
|
8
|
+
<IconStyle>
|
9
|
+
<Icon/>
|
10
|
+
</IconStyle>
|
11
|
+
</Style>
|
12
|
+
<Folder>
|
13
|
+
<name>Waypoints</name>
|
14
|
+
<Placemark>
|
15
|
+
<name>001</name>
|
16
|
+
<Snippet maxLines="0"/>
|
17
|
+
<Style id="normalPlacemark">
|
18
|
+
<IconStyle>
|
19
|
+
<Icon>
|
20
|
+
<href>c:\program files\gpx2kml\icon\tf_ge\01.png</href>
|
21
|
+
</Icon>
|
22
|
+
</IconStyle>
|
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>c:\program files\gpx2kml\test - c:\program files\gpx2kml\test]]></description>
|
25
|
+
<Point>
|
26
|
+
<coordinates>-92.2972443,38.9199972</coordinates>
|
27
|
+
</Point>
|
28
|
+
</Placemark>
|
29
|
+
<Placemark>
|
30
|
+
<name>002</name>
|
31
|
+
<Snippet maxLines="0"/>
|
32
|
+
<Style id="normalPlacemark">
|
33
|
+
<IconStyle>
|
34
|
+
<Icon>
|
35
|
+
<href>c:\program files\gpx2kml\icon\tf_ge\03.png</href>
|
36
|
+
</Icon>
|
37
|
+
</IconStyle>
|
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>c:\program files\gpx2kml\test - c:\program files\gpx2kml\test]]></description>
|
40
|
+
<Point>
|
41
|
+
<coordinates>-92.2969611,38.9197762</coordinates>
|
42
|
+
</Point>
|
43
|
+
</Placemark>
|
44
|
+
<Placemark>
|
45
|
+
<name>003</name>
|
46
|
+
<Snippet maxLines="0"/>
|
47
|
+
<Style id="normalPlacemark">
|
48
|
+
<IconStyle>
|
49
|
+
<Icon>
|
50
|
+
<href>c:\program files\gpx2kml\icon\tf_ge\04.png</href>
|
51
|
+
</Icon>
|
52
|
+
</IconStyle>
|
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>c:\program files\gpx2kml\test - c:\program files\gpx2kml\test]]></description>
|
55
|
+
<Point>
|
56
|
+
<coordinates>-92.2971813,38.9195040</coordinates>
|
57
|
+
</Point>
|
58
|
+
</Placemark>
|
59
|
+
<Placemark>
|
60
|
+
<name>004</name>
|
61
|
+
<Snippet maxLines="0"/>
|
62
|
+
<Style id="normalPlacemark">
|
63
|
+
<IconStyle>
|
64
|
+
<Icon>
|
65
|
+
<href>c:\program files\gpx2kml\icon\tf_ge\11.png</href>
|
66
|
+
</Icon>
|
67
|
+
</IconStyle>
|
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>c:\program files\gpx2kml\test - c:\program files\gpx2kml\test]]></description>
|
70
|
+
<Point>
|
71
|
+
<coordinates>-92.2977024,38.9191455</coordinates>
|
72
|
+
</Point>
|
73
|
+
</Placemark>
|
74
|
+
<Placemark>
|
75
|
+
<name>005</name>
|
76
|
+
<Snippet maxLines="0"/>
|
77
|
+
<Style id="normalPlacemark">
|
78
|
+
<IconStyle>
|
79
|
+
<Icon>
|
80
|
+
<href>c:\program files\gpx2kml\icon\tf_ge\18.png</href>
|
81
|
+
</Icon>
|
82
|
+
</IconStyle>
|
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>c:\program files\gpx2kml\test - c:\program files\gpx2kml\test]]></description>
|
85
|
+
<Point>
|
86
|
+
<coordinates>-92.2973642,38.9191831</coordinates>
|
87
|
+
</Point>
|
88
|
+
</Placemark>
|
89
|
+
<Placemark>
|
90
|
+
<name>006</name>
|
91
|
+
<Snippet maxLines="0"/>
|
92
|
+
<Style id="normalPlacemark">
|
93
|
+
<IconStyle>
|
94
|
+
<Icon>
|
95
|
+
<href>c:\program files\gpx2kml\icon\tf_ge\15.png</href>
|
96
|
+
</Icon>
|
97
|
+
</IconStyle>
|
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>c:\program files\gpx2kml\test - c:\program files\gpx2kml\test]]></description>
|
100
|
+
<Point>
|
101
|
+
<coordinates>-92.2967348,38.9196337</coordinates>
|
102
|
+
</Point>
|
103
|
+
</Placemark>
|
104
|
+
<Placemark>
|
105
|
+
<name>007</name>
|
106
|
+
<Snippet maxLines="0"/>
|
107
|
+
<Style id="normalPlacemark">
|
108
|
+
<IconStyle>
|
109
|
+
<Icon>
|
110
|
+
<href>c:\program files\gpx2kml\icon\tf_ge\13.png</href>
|
111
|
+
</Icon>
|
112
|
+
</IconStyle>
|
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>c:\program files\gpx2kml\test - c:\program files\gpx2kml\test]]></description>
|
115
|
+
<Point>
|
116
|
+
<coordinates>-92.2963225,38.9193832</coordinates>
|
117
|
+
</Point>
|
118
|
+
</Placemark>
|
119
|
+
<Placemark>
|
120
|
+
<name>008</name>
|
121
|
+
<Snippet maxLines="0"/>
|
122
|
+
<Style id="normalPlacemark">
|
123
|
+
<IconStyle>
|
124
|
+
<Icon>
|
125
|
+
<href>c:\program files\gpx2kml\icon\tf_ge\14.png</href>
|
126
|
+
</Icon>
|
127
|
+
</IconStyle>
|
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>c:\program files\gpx2kml\test - c:\program files\gpx2kml\test]]></description>
|
130
|
+
<Point>
|
131
|
+
<coordinates>-92.2959630,38.9192829</coordinates>
|
132
|
+
</Point>
|
133
|
+
</Placemark>
|
134
|
+
<Placemark>
|
135
|
+
<name>009</name>
|
136
|
+
<Snippet maxLines="0"/>
|
137
|
+
<Style id="normalPlacemark">
|
138
|
+
<IconStyle>
|
139
|
+
<Icon>
|
140
|
+
<href>c:\program files\gpx2kml\icon\tf_ge\19.png</href>
|
141
|
+
</Icon>
|
142
|
+
</IconStyle>
|
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>c:\program files\gpx2kml\test - c:\program files\gpx2kml\test]]></description>
|
145
|
+
<Point>
|
146
|
+
<coordinates>-92.2965171,38.9196773</coordinates>
|
147
|
+
</Point>
|
148
|
+
</Placemark>
|
149
|
+
<Placemark>
|
150
|
+
<name>010</name>
|
151
|
+
<Snippet maxLines="0"/>
|
152
|
+
<Style id="normalPlacemark">
|
153
|
+
<IconStyle>
|
154
|
+
<Icon>
|
155
|
+
<href>c:\program files\gpx2kml\icon\tf_ge\16.png</href>
|
156
|
+
</Icon>
|
157
|
+
</IconStyle>
|
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>c:\program files\gpx2kml\test - c:\program files\gpx2kml\test]]></description>
|
160
|
+
<Point>
|
161
|
+
<coordinates>-92.2973907,38.9202020</coordinates>
|
162
|
+
</Point>
|
163
|
+
</Placemark>
|
164
|
+
<Placemark>
|
165
|
+
<name>011</name>
|
166
|
+
<Snippet maxLines="0"/>
|
167
|
+
<Style id="normalPlacemark">
|
168
|
+
<IconStyle>
|
169
|
+
<Icon>
|
170
|
+
<href>c:\program files\gpx2kml\icon\tf_ge\21.png</href>
|
171
|
+
</Icon>
|
172
|
+
</IconStyle>
|
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>c:\program files\gpx2kml\test - c:\program files\gpx2kml\test]]></description>
|
175
|
+
<Point>
|
176
|
+
<coordinates>-92.2972759,38.9207150</coordinates>
|
177
|
+
</Point>
|
178
|
+
</Placemark>
|
179
|
+
<Placemark>
|
180
|
+
<name>012</name>
|
181
|
+
<Snippet maxLines="0"/>
|
182
|
+
<Style id="normalPlacemark">
|
183
|
+
<IconStyle>
|
184
|
+
<Icon>
|
185
|
+
<href>c:\program files\gpx2kml\icon\tf_ge\22.png</href>
|
186
|
+
</Icon>
|
187
|
+
</IconStyle>
|
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>c:\program files\gpx2kml\test - c:\program files\gpx2kml\test]]></description>
|
190
|
+
<Point>
|
191
|
+
<coordinates>-92.2974574,38.9208083</coordinates>
|
192
|
+
</Point>
|
193
|
+
</Placemark>
|
194
|
+
<Placemark>
|
195
|
+
<name>013</name>
|
196
|
+
<Snippet maxLines="0"/>
|
197
|
+
<Style id="normalPlacemark">
|
198
|
+
<IconStyle>
|
199
|
+
<Icon>
|
200
|
+
<href>c:\program files\gpx2kml\icon\tf_ge\23.png</href>
|
201
|
+
</Icon>
|
202
|
+
</IconStyle>
|
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>c:\program files\gpx2kml\test - c:\program files\gpx2kml\test]]></description>
|
205
|
+
<Point>
|
206
|
+
<coordinates>-92.2977240,38.9205154</coordinates>
|
207
|
+
</Point>
|
208
|
+
</Placemark>
|
209
|
+
<Placemark>
|
210
|
+
<name>014</name>
|
211
|
+
<Snippet maxLines="0"/>
|
212
|
+
<Style id="normalPlacemark">
|
213
|
+
<IconStyle>
|
214
|
+
<Icon>
|
215
|
+
<href>c:\program files\gpx2kml\icon\tf_ge\02.png</href>
|
216
|
+
</Icon>
|
217
|
+
</IconStyle>
|
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>c:\program files\gpx2kml\test - c:\program files\gpx2kml\test]]></description>
|
220
|
+
<Point>
|
221
|
+
<coordinates>-92.2983951,38.9201116</coordinates>
|
222
|
+
</Point>
|
223
|
+
</Placemark>
|
224
|
+
<Placemark>
|
225
|
+
<name>2804 Wild Plum</name>
|
226
|
+
<Snippet maxLines="0"/>
|
227
|
+
<Style id="normalPlacemark">
|
228
|
+
<IconStyle>
|
229
|
+
<Icon>
|
230
|
+
<href>c:\program files\gpx2kml\icon\tf_ge\default.png</href>
|
231
|
+
</Icon>
|
232
|
+
</IconStyle>
|
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>c:\program files\gpx2kml\test - c:\program files\gpx2kml\test]]></description>
|
235
|
+
<Point>
|
236
|
+
<coordinates>-92.2983507,38.9200473</coordinates>
|
237
|
+
</Point>
|
238
|
+
</Placemark>
|
239
|
+
</Folder>
|
240
|
+
<Folder>
|
241
|
+
<name>Tracks</name>
|
242
|
+
<Style id="18-OCT-09_Style">
|
243
|
+
<LineStyle>
|
244
|
+
<color>f0000080</color>
|
245
|
+
<width>3</width>
|
246
|
+
</LineStyle>
|
247
|
+
</Style>
|
248
|
+
<Placemark id="18-OCT-09">
|
249
|
+
<name>18-OCT-09</name>
|
250
|
+
<description><![CDATA[KML file, track, and waypoint comment.]]></description>
|
251
|
+
<styleUrl>#18-OCT-09_Style</styleUrl>
|
252
|
+
<LineString>
|
253
|
+
<extrude>1</extrude>
|
254
|
+
<tessellate>1</tessellate>
|
255
|
+
<altitudeMode>clampedToGround</altitudeMode>
|
256
|
+
<coordinates>-92.2974500,38.9192166,0 -92.2974480,38.9192131,0 -92.2974491,38.9192131,0 -92.2974498,38.9192121,0 -92.2974481,38.9192053,0 -92.2974619,38.9191897,0 -92.2975066,38.9191654,0 -92.2975411,38.9191634,0 -92.2975676,38.9191661,0 -92.2977170,38.9191401,0 -92.2977401,38.9190596,0 -92.2977100,38.9190338,0 -92.2976056,38.9190399,0 -92.2975292,38.9190577,0 -92.2974253,38.9191198,0 -92.2973117,38.9192653,0 -92.2971953,38.9193899,0 -92.2970750,38.9195301,0 -92.2969539,38.9196197,0 -92.2968409,38.9196836,0 -92.2968185,38.9196751,0 -92.2966788,38.9195942,0 -92.2965691,38.9195161,0 -92.2964531,38.9194482,0 -92.2963269,38.9193805,0 -92.2963000,38.9193815,0 -92.2961640,38.9192872,0 -92.2960841,38.9192231,0 -92.2960546,38.9192064,0 -92.2959645,38.9193209,0 -92.2960287,38.9193560,0 -92.2960931,38.9193992,0 -92.2961377,38.9194369,0 -92.2962814,38.9195250,0 -92.2962871,38.9195328,0 -92.2963490,38.9195311,0 -92.2963994,38.9195736,0 -92.2964627,38.9196379,0 -92.2964759,38.9196596,0 -92.2966064,38.9197274,0 -92.2968050,38.9198301,0 -92.2968177,38.9198532,0 -92.2968948,38.9199238,0 -92.2969240,38.9199364,0 -92.2969881,38.9199673,0 -92.2971074,38.9200326,0 -92.2971658,38.9200600,0 -92.2972693,38.9201327,0 -92.2974267,38.9202471,0 -92.2973874,38.9203061,0 -92.2973550,38.9204382,0 -92.2972989,38.9206033,0 -92.2972725,38.9207438,0 -92.2972764,38.9207743,0 -92.2974020,38.9208257,0 -92.2974725,38.9207973,0 -92.2976285,38.9206118,0 -92.2977527,38.9204926,0 -92.2979666,38.9202957,0 -92.2981386,38.9201607,0 -92.2982495,38.9200683,0 -92.2982619,38.9200570,0 -92.2983682,38.9200564,0 -92.2983768,38.9200948,0 -92.2983971,38.9201153,0 -92.2983873,38.9201652,0</coordinates>
|
257
|
+
</LineString>
|
258
|
+
</Placemark>
|
259
|
+
<Style id="ACTIVE LOG 001_Style">
|
260
|
+
<LineStyle>
|
261
|
+
<color>f000ffff</color>
|
262
|
+
<width>3</width>
|
263
|
+
</LineStyle>
|
264
|
+
</Style>
|
265
|
+
<Placemark id="ACTIVE LOG 001">
|
266
|
+
<name>ACTIVE LOG 001</name>
|
267
|
+
<description><![CDATA[KML file, track, and waypoint comment.]]></description>
|
268
|
+
<styleUrl>#ACTIVE LOG 001_Style</styleUrl>
|
269
|
+
<LineString>
|
270
|
+
<extrude>1</extrude>
|
271
|
+
<tessellate>1</tessellate>
|
272
|
+
<altitudeMode>clampedToGround</altitudeMode>
|
273
|
+
<coordinates>-92.2974500,38.9192166,0</coordinates>
|
274
|
+
</LineString>
|
275
|
+
</Placemark>
|
276
|
+
<Style id="ACTIVE LOG 002_Style">
|
277
|
+
<LineStyle>
|
278
|
+
<color>f000ffff</color>
|
279
|
+
<width>3</width>
|
280
|
+
</LineStyle>
|
281
|
+
</Style>
|
282
|
+
<Placemark id="ACTIVE LOG 002">
|
283
|
+
<name>ACTIVE LOG 002</name>
|
284
|
+
<description><![CDATA[KML file, track, and waypoint comment.]]></description>
|
285
|
+
<styleUrl>#ACTIVE LOG 002_Style</styleUrl>
|
286
|
+
<LineString>
|
287
|
+
<extrude>1</extrude>
|
288
|
+
<tessellate>1</tessellate>
|
289
|
+
<altitudeMode>clampedToGround</altitudeMode>
|
290
|
+
<coordinates>-92.2974480,38.9192131,0</coordinates>
|
291
|
+
</LineString>
|
292
|
+
</Placemark>
|
293
|
+
<Style id="ACTIVE LOG 003_Style">
|
294
|
+
<LineStyle>
|
295
|
+
<color>f000ffff</color>
|
296
|
+
<width>3</width>
|
297
|
+
</LineStyle>
|
298
|
+
</Style>
|
299
|
+
<Placemark id="ACTIVE LOG 003">
|
300
|
+
<name>ACTIVE LOG 003</name>
|
301
|
+
<description><![CDATA[KML file, track, and waypoint comment.]]></description>
|
302
|
+
<styleUrl>#ACTIVE LOG 003_Style</styleUrl>
|
303
|
+
<LineString>
|
304
|
+
<extrude>1</extrude>
|
305
|
+
<tessellate>1</tessellate>
|
306
|
+
<altitudeMode>clampedToGround</altitudeMode>
|
307
|
+
<coordinates>-92.2974491,38.9192131,0</coordinates>
|
308
|
+
</LineString>
|
309
|
+
</Placemark>
|
310
|
+
<Style id="ACTIVE LOG 004_Style">
|
311
|
+
<LineStyle>
|
312
|
+
<color>f000ffff</color>
|
313
|
+
<width>3</width>
|
314
|
+
</LineStyle>
|
315
|
+
</Style>
|
316
|
+
<Placemark id="ACTIVE LOG 004">
|
317
|
+
<name>ACTIVE LOG 004</name>
|
318
|
+
<description><![CDATA[KML file, track, and waypoint comment.]]></description>
|
319
|
+
<styleUrl>#ACTIVE LOG 004_Style</styleUrl>
|
320
|
+
<LineString>
|
321
|
+
<extrude>1</extrude>
|
322
|
+
<tessellate>1</tessellate>
|
323
|
+
<altitudeMode>clampedToGround</altitudeMode>
|
324
|
+
<coordinates>-92.2974498,38.9192121,0 -92.2974481,38.9192053,0 -92.2974619,38.9191897,0 -92.2975066,38.9191654,0 -92.2975411,38.9191634,0 -92.2975676,38.9191661,0 -92.2977170,38.9191401,0 -92.2977401,38.9190596,0 -92.2977100,38.9190338,0 -92.2976056,38.9190399,0 -92.2975292,38.9190577,0 -92.2974253,38.9191198,0 -92.2973117,38.9192653,0 -92.2971953,38.9193899,0 -92.2970750,38.9195301,0 -92.2969539,38.9196197,0 -92.2968409,38.9196836,0 -92.2968185,38.9196751,0 -92.2966788,38.9195942,0 -92.2965691,38.9195161,0 -92.2964531,38.9194482,0 -92.2963269,38.9193805,0 -92.2963000,38.9193815,0 -92.2961640,38.9192872,0 -92.2960841,38.9192231,0 -92.2960546,38.9192064,0 -92.2959645,38.9193209,0 -92.2960287,38.9193560,0 -92.2960931,38.9193992,0 -92.2961377,38.9194369,0 -92.2962814,38.9195250,0 -92.2962871,38.9195328,0 -92.2963490,38.9195311,0 -92.2963994,38.9195736,0 -92.2964627,38.9196379,0 -92.2964759,38.9196596,0 -92.2966064,38.9197274,0 -92.2968050,38.9198301,0 -92.2968177,38.9198532,0 -92.2968948,38.9199238,0 -92.2969240,38.9199364,0 -92.2969881,38.9199673,0 -92.2971074,38.9200326,0 -92.2971658,38.9200600,0 -92.2972693,38.9201327,0 -92.2974267,38.9202471,0 -92.2973874,38.9203061,0 -92.2973550,38.9204382,0 -92.2972989,38.9206033,0 -92.2972725,38.9207438,0 -92.2972764,38.9207743,0 -92.2974020,38.9208257,0 -92.2974725,38.9207973,0 -92.2976285,38.9206118,0 -92.2977527,38.9204926,0 -92.2979666,38.9202957,0 -92.2981386,38.9201607,0 -92.2982495,38.9200683,0 -92.2982619,38.9200570,0 -92.2983682,38.9200564,0 -92.2983768,38.9200948,0 -92.2983971,38.9201153,0 -92.2983873,38.9201652,0</coordinates>
|
325
|
+
</LineString>
|
326
|
+
</Placemark>
|
327
|
+
</Folder>
|
328
|
+
</Document>
|
329
|
+
</kml>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'timecop'
|
2
|
+
require_relative '../../../lib/tf1_converter'
|
3
|
+
|
4
|
+
module TF1Converter
|
5
|
+
describe Translation do
|
6
|
+
it "translates a file correctly" do
|
7
|
+
execution_time = Time.local(2008, 9, 1, 12, 0, 0)
|
8
|
+
Timecop.freeze(execution_time)
|
9
|
+
local_dir = File.dirname(__FILE__)
|
10
|
+
path = File.expand_path('../../fixtures', local_dir)
|
11
|
+
input = File.open("#{path}/test.gpx", 'r')
|
12
|
+
output = File.open("#{path}/test.kml", 'w')
|
13
|
+
expected = File.open("#{path}/expected.kml", 'r')
|
14
|
+
TF1Converter::Config.load(File.expand_path('../../../example/config.yml', local_dir))
|
15
|
+
TF1Converter::Translation.from(input).into(output)
|
16
|
+
|
17
|
+
result = File.open("#{path}/test.kml", 'r')
|
18
|
+
result.read.should == expected.read
|
19
|
+
Timecop.return
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/tf1_converter.gemspec
CHANGED
@@ -20,6 +20,7 @@ Gem::Specification.new do |gem|
|
|
20
20
|
gem.add_development_dependency 'rake', '10.0.3'
|
21
21
|
gem.add_development_dependency 'rspec', '2.12.0'
|
22
22
|
gem.add_development_dependency 'pry', '0.9.11.4'
|
23
|
+
gem.add_development_dependency 'timecop', '0.5.9.2'
|
23
24
|
|
24
25
|
gem.add_dependency 'thor'
|
25
26
|
gem.add_dependency 'nokogiri'
|
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.
|
4
|
+
version: 0.2.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -59,6 +59,22 @@ dependencies:
|
|
59
59
|
- - '='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: 0.9.11.4
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: timecop
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - '='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 0.5.9.2
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - '='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 0.5.9.2
|
62
78
|
- !ruby/object:Gem::Dependency
|
63
79
|
name: thor
|
64
80
|
requirement: !ruby/object:Gem::Requirement
|
@@ -139,17 +155,18 @@ files:
|
|
139
155
|
- Rakefile
|
140
156
|
- bin/tf1convert
|
141
157
|
- example/config.yml
|
158
|
+
- example/windowsconfig.yml
|
142
159
|
- harness.rb
|
143
160
|
- input/test.gpx
|
144
161
|
- lib/tf1_converter.rb
|
145
162
|
- lib/tf1_converter/config.rb
|
146
163
|
- lib/tf1_converter/translation.rb
|
147
164
|
- lib/tf1_converter/version.rb
|
148
|
-
- lib/tf1_converter/waypoint.rb
|
149
165
|
- output/test.kml
|
166
|
+
- spec/fixtures/expected.kml
|
150
167
|
- spec/fixtures/test.gpx
|
151
168
|
- spec/fixtures/test.kml
|
152
|
-
- spec/
|
169
|
+
- spec/lib/tf1_converter/translation_spec.rb
|
153
170
|
- tf1_converter.gemspec
|
154
171
|
homepage: ''
|
155
172
|
licenses: []
|
@@ -165,7 +182,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
165
182
|
version: '0'
|
166
183
|
segments:
|
167
184
|
- 0
|
168
|
-
hash:
|
185
|
+
hash: -896173598526419622
|
169
186
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
170
187
|
none: false
|
171
188
|
requirements:
|
@@ -174,7 +191,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
174
191
|
version: '0'
|
175
192
|
segments:
|
176
193
|
- 0
|
177
|
-
hash:
|
194
|
+
hash: -896173598526419622
|
178
195
|
requirements: []
|
179
196
|
rubyforge_project:
|
180
197
|
rubygems_version: 1.8.23
|
@@ -182,6 +199,7 @@ signing_key:
|
|
182
199
|
specification_version: 3
|
183
200
|
summary: A GPX to KML converter for Missouri Task Force 1
|
184
201
|
test_files:
|
202
|
+
- spec/fixtures/expected.kml
|
185
203
|
- spec/fixtures/test.gpx
|
186
204
|
- spec/fixtures/test.kml
|
187
|
-
- spec/
|
205
|
+
- spec/lib/tf1_converter/translation_spec.rb
|
@@ -1,48 +0,0 @@
|
|
1
|
-
require 'nokogiri'
|
2
|
-
require 'builder'
|
3
|
-
|
4
|
-
module TF1Converter
|
5
|
-
|
6
|
-
class Waypoint
|
7
|
-
def initialize(gpx)
|
8
|
-
@gpx = gpx
|
9
|
-
end
|
10
|
-
|
11
|
-
def to_xml
|
12
|
-
gpx_doc = Nokogiri::XML(@gpx)
|
13
|
-
wpt_node = gpx_doc.xpath('//wpt').first
|
14
|
-
|
15
|
-
kml_builder = Builder::XmlMarkup.new
|
16
|
-
|
17
|
-
kml_builder.placemark do |placemark|
|
18
|
-
placemark.name(gpx_doc.xpath('//name').first.text)
|
19
|
-
placemark.Snippet(:maxLines => "0")
|
20
|
-
|
21
|
-
placemark.Style(:id => "normalPlacemark") do |style|
|
22
|
-
style.IconStyle do |is|
|
23
|
-
is.Icon do |i|
|
24
|
-
i.href
|
25
|
-
end
|
26
|
-
end
|
27
|
-
end
|
28
|
-
|
29
|
-
placemark.description do |desc|
|
30
|
-
timestamp = gpx_doc.xpath('//desc').first.text
|
31
|
-
utm = nil
|
32
|
-
usng = nil
|
33
|
-
filepaths = ''
|
34
|
-
desc.cdata!(%Q{#{timestamp}<br>Search Start<br>KML file, track, and waypoint comment.<br>USNG: #{usng}<br>UTM: #{utm}<br>#{filepaths}})
|
35
|
-
end
|
36
|
-
|
37
|
-
placemark.point do |point|
|
38
|
-
lon = wpt_node.attributes['lon'].value
|
39
|
-
lat = wpt_node.attributes['lat'].value
|
40
|
-
coords = "#{lon},#{lat}"
|
41
|
-
point.coordinates(coords)
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
end
|
47
|
-
|
48
|
-
end
|
data/spec/waypoint_spec.rb
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
require_relative '../lib/tf1_converter/waypoint'
|
2
|
-
|
3
|
-
module TF1Converter
|
4
|
-
|
5
|
-
describe Waypoint do
|
6
|
-
|
7
|
-
it 'converts gpx to xml waypoints' do
|
8
|
-
gpx = %Q{
|
9
|
-
<wpt lat="38.9199972" lon="-92.2972443">
|
10
|
-
<ele>159.7036133</ele>
|
11
|
-
<name>001</name>
|
12
|
-
<cmt>18-OCT-09 2:17:38PM</cmt>
|
13
|
-
<desc>18-OCT-09 2:17:38PM</desc>
|
14
|
-
<sym>Custom 0</sym>
|
15
|
-
<extensions>
|
16
|
-
<gpxx:WaypointExtension xmlns:gpxx="http://www.garmin.com/xmlschemas/GpxExtensions/v3">
|
17
|
-
<gpxx:DisplayMode>SymbolAndName</gpxx:DisplayMode>
|
18
|
-
</gpxx:WaypointExtension>
|
19
|
-
</extensions>
|
20
|
-
</wpt>
|
21
|
-
}
|
22
|
-
|
23
|
-
waypoint = Waypoint.new(gpx)
|
24
|
-
kml = waypoint.to_xml
|
25
|
-
kml.should =~ /<name>001<\/name>/
|
26
|
-
kml.should =~ /<Snippet maxLines="0"/
|
27
|
-
kml.should =~ /<Style id="normalPlacemark">/
|
28
|
-
kml.should =~ /<coordinates>-92\.2972443,38\.9199972<\/coordinates>/
|
29
|
-
kml.should =~ /CDATA\[18-OCT-09 2:17:38PM<br>Search Start<br>KML file, tracking, and waypoint comment.<br>USNG: 15SWD6092208133<br>UTM: 15S 560921.64 4308133.45<br>/
|
30
|
-
end
|
31
|
-
|
32
|
-
end
|
33
|
-
|
34
|
-
end
|