open_gpx_2_kml 0.9.1
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/.gitignore +11 -0
- data/.rbenv-version +1 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +46 -0
- data/README.md +17 -0
- data/Rakefile +2 -0
- data/bin/openGpx2Kml +21 -0
- data/example/config.csv +57 -0
- data/example/windowsconfig.csv +57 -0
- data/harness.rb +16 -0
- data/input/test.gpx +724 -0
- data/lib/tf1_converter/config.rb +63 -0
- data/lib/tf1_converter/csv_file.rb +19 -0
- data/lib/tf1_converter/gpx/track.rb +30 -0
- data/lib/tf1_converter/gpx/trackpoint.rb +22 -0
- data/lib/tf1_converter/gpx/waypoint.rb +76 -0
- data/lib/tf1_converter/gpx_file.rb +19 -0
- data/lib/tf1_converter/kml/track_color.rb +28 -0
- data/lib/tf1_converter/kml/track_node.rb +36 -0
- data/lib/tf1_converter/kml_file.rb +80 -0
- data/lib/tf1_converter/kmz_file.rb +27 -0
- data/lib/tf1_converter/translation.rb +34 -0
- data/lib/tf1_converter/version.rb +3 -0
- data/lib/tf1_converter.rb +3 -0
- data/openGpx2Kml.gemspec +30 -0
- data/output/test.kml +329 -0
- data/spec/fixtures/expected.kml +329 -0
- data/spec/fixtures/ftwood2.gpx +7481 -0
- data/spec/fixtures/ftwood2_expected.kml +1 -0
- data/spec/fixtures/test.gpx +724 -0
- data/spec/fixtures/waypoint-by-name.gpx +709 -0
- data/spec/lib/tf1_converter/gpx/track_spec.rb +20 -0
- data/spec/lib/tf1_converter/gpx/waypoint_spec.rb +70 -0
- data/spec/lib/tf1_converter/kml/track_color_spec.rb +29 -0
- data/spec/lib/tf1_converter/kmz_file_spec.rb +18 -0
- data/spec/lib/tf1_converter/translation_spec.rb +48 -0
- metadata +242 -0
data/.gitignore
ADDED
data/.rbenv-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
1.9.3-p327
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,46 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
open_gpx_2_kml (0.9.1)
|
5
|
+
builder (= 3.1.4)
|
6
|
+
geo_swap (= 0.2.1)
|
7
|
+
nokogiri (= 1.5.6)
|
8
|
+
rubyzip (= 0.9.9)
|
9
|
+
thor (= 0.17.0)
|
10
|
+
|
11
|
+
GEM
|
12
|
+
remote: https://rubygems.org/
|
13
|
+
specs:
|
14
|
+
builder (3.1.4)
|
15
|
+
coderay (1.0.8)
|
16
|
+
diff-lcs (1.1.3)
|
17
|
+
geo_swap (0.2.1)
|
18
|
+
method_source (0.8.1)
|
19
|
+
nokogiri (1.5.6)
|
20
|
+
pry (0.9.11.4)
|
21
|
+
coderay (~> 1.0.5)
|
22
|
+
method_source (~> 0.8)
|
23
|
+
slop (~> 3.4)
|
24
|
+
rake (10.0.3)
|
25
|
+
rspec (2.12.0)
|
26
|
+
rspec-core (~> 2.12.0)
|
27
|
+
rspec-expectations (~> 2.12.0)
|
28
|
+
rspec-mocks (~> 2.12.0)
|
29
|
+
rspec-core (2.12.2)
|
30
|
+
rspec-expectations (2.12.1)
|
31
|
+
diff-lcs (~> 1.1.3)
|
32
|
+
rspec-mocks (2.12.1)
|
33
|
+
rubyzip (0.9.9)
|
34
|
+
slop (3.4.3)
|
35
|
+
thor (0.17.0)
|
36
|
+
timecop (0.5.9.2)
|
37
|
+
|
38
|
+
PLATFORMS
|
39
|
+
ruby
|
40
|
+
|
41
|
+
DEPENDENCIES
|
42
|
+
open_gpx_2_kml!
|
43
|
+
pry (= 0.9.11.4)
|
44
|
+
rake (= 10.0.3)
|
45
|
+
rspec (= 2.12.0)
|
46
|
+
timecop (= 0.5.9.2)
|
data/README.md
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
### INSTALLATION
|
2
|
+
|
3
|
+
## WINDOWS
|
4
|
+
|
5
|
+
1) Install ruby (http://rubyinstaller.org), must be ruby 1.9 or above.
|
6
|
+
|
7
|
+
2) Make sure ruby is on the path (ruby is installed at C:\Ruby193 or similar,
|
8
|
+
follow these directions to modify your path: http://www.computerhope.com/issues/ch000549.htm#1)
|
9
|
+
|
10
|
+
3) install the converter by running this at the command prompt:
|
11
|
+
|
12
|
+
gem install tf1_converter
|
13
|
+
|
14
|
+
|
15
|
+
4) add a config file to a convenient location (see example/config.csv)
|
16
|
+
|
17
|
+
5) edit the config file in WordPad or similar, make sure the paths match where your files are.
|
data/Rakefile
ADDED
data/bin/openGpx2Kml
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'tf1_converter'
|
4
|
+
|
5
|
+
config_file = ARGV[0]
|
6
|
+
TF1Converter::Config.load(config_file)
|
7
|
+
input_path = TF1Converter::Config.input
|
8
|
+
output_path = TF1Converter::Config.output
|
9
|
+
|
10
|
+
Dir.foreach(input_path) do |file|
|
11
|
+
unless ['.', '..'].include? file
|
12
|
+
input = File.open("#{input_path}/#{file}", 'r')
|
13
|
+
outfile = file.gsub(/\.gpx$/, '.kml')
|
14
|
+
output = File.open("#{output_path}/#{outfile}", 'w')
|
15
|
+
TF1Converter::Translation.from(input).into(output)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
Dir.foreach(output_path) do |file|
|
20
|
+
File.delete(file) if file =~ /\.kml$/
|
21
|
+
end
|
data/example/config.csv
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
The path of the directory where you are putting gpx files
|
2
|
+
INPUT
|
3
|
+
input
|
4
|
+
|
5
|
+
The path of the directory where you are wanting the KML files
|
6
|
+
OUTPUT
|
7
|
+
output
|
8
|
+
|
9
|
+
The full path of the directory where your icons are stored
|
10
|
+
ICON_PATH
|
11
|
+
/Users/ethanvizitei/icons
|
12
|
+
|
13
|
+
Table of Icons (symbol/filename/meaning/custom_name)
|
14
|
+
ICONS
|
15
|
+
Custom 0,01.png,Search Start,icon_name_1
|
16
|
+
Custom 1,02.png,Search Stop,icon_name_2
|
17
|
+
Custom 2,03.png,Victim Detected,icon_name_3
|
18
|
+
Custom 3,04.png,Victim Confirmed,icon_name_4
|
19
|
+
Custom 4,05.png,Meaning 5,icon_name_5
|
20
|
+
Custom 5,06.png,Meaning 6,icon_name_6
|
21
|
+
Custom 6,07.png,Meaning 7,icon_name_7
|
22
|
+
Custom 7,08.png,Meaning 8,icon_name_8
|
23
|
+
Custom 8,09.png,Meaning 9,icon_name_9
|
24
|
+
Custom 9,10.png,Meaning 10,icon_name_10
|
25
|
+
Custom 10,11.png,Collection Point,icon_name_11
|
26
|
+
Custom 11,12.png,Meaning 12,icon_name_12
|
27
|
+
Custom 12,13.png,Command Post,icon_name_13
|
28
|
+
Custom 13,14.png,Staging Area,icon_name_14
|
29
|
+
Custom 14,15.png,Criminal Activity,icon_name_15
|
30
|
+
Custom 15,16.png,Meaning 16,icon_name_16
|
31
|
+
Custom 16,17.png,Water Level,icon_name_17
|
32
|
+
Custom 17,18.png,Structure Damage / Safe,icon_name_18
|
33
|
+
Custom 18,19.png,Meaning 19,icon_name_19
|
34
|
+
Custom 19,20.png,Structure Not Safe,icon_name_20
|
35
|
+
Custom 20,21.png,Extra 21,icon_name_21
|
36
|
+
Custom 21,22.png,Extra 22,icon_name_22
|
37
|
+
Custom 22,23.png,Extra 23,icon_name_23
|
38
|
+
Residence,default.png,Default,icon_name_24
|
39
|
+
|
40
|
+
Table of Colors (Name/KML Hex)
|
41
|
+
COLORS
|
42
|
+
DarkRed,f0000080
|
43
|
+
Yellow,f000ffff
|
44
|
+
Blue,f0ff0000
|
45
|
+
Red,f01400ff
|
46
|
+
Orange,f014b4ff
|
47
|
+
Green,f000b414
|
48
|
+
Purple,f0ff7878
|
49
|
+
Pink,f0ff78f0
|
50
|
+
|
51
|
+
Switch for Using Constant Color ('true' for one color, 'false' for iteration)
|
52
|
+
USE_CONSTANT_COLOR
|
53
|
+
false
|
54
|
+
|
55
|
+
The color to use if the constant color switch is flipped (must be a key from the colors table)
|
56
|
+
CONSTANT_COLOR
|
57
|
+
Blue
|
@@ -0,0 +1,57 @@
|
|
1
|
+
The path of the directory where you are putting gpx files
|
2
|
+
INPUT
|
3
|
+
c:\Documents and Settings\FEMA\TF1Converter\Input
|
4
|
+
|
5
|
+
The path of the directory where you are wanting the KML files
|
6
|
+
OUTPUT
|
7
|
+
c:\Documents and Settings\FEMA\TF1Converter\Output
|
8
|
+
|
9
|
+
The full path of the directory where your icons are stored
|
10
|
+
ICON_PATH
|
11
|
+
c:\program files\gpx2kml\icon\tf_ge\
|
12
|
+
|
13
|
+
Table of Icons (symbol/filename/meaning/custom_name)
|
14
|
+
ICONS
|
15
|
+
Custom 0,01.png,Search Start,icon_name_1
|
16
|
+
Custom 1,02.png,Search Stop,icon_name_2
|
17
|
+
Custom 2,03.png,Victim Detected,icon_name_3
|
18
|
+
Custom 3,04.png,Victim Confirmed,icon_name_4
|
19
|
+
Custom 4,05.png,Meaning 5,icon_name_5
|
20
|
+
Custom 5,06.png,Meaning 6,icon_name_6
|
21
|
+
Custom 6,07.png,Meaning 7,icon_name_7
|
22
|
+
Custom 7,08.png,Meaning 8,icon_name_8
|
23
|
+
Custom 8,09.png,Meaning 9,icon_name_9
|
24
|
+
Custom 9,10.png,Meaning 10,icon_name_10
|
25
|
+
Custom 10,11.png,Collection Point,icon_name_11
|
26
|
+
Custom 11,12.png,Meaning 12,icon_name_12
|
27
|
+
Custom 12,13.png,Command Post,icon_name_13
|
28
|
+
Custom 13,14.png,Staging Area,icon_name_14
|
29
|
+
Custom 14,15.png,Criminal Activity,icon_name_15
|
30
|
+
Custom 15,16.png,Meaning 16,icon_name_16
|
31
|
+
Custom 16,17.png,Water Level,icon_name_17
|
32
|
+
Custom 17,18.png,Structure Damage / Safe,icon_name_18
|
33
|
+
Custom 18,19.png,Meaning 19,icon_name_19
|
34
|
+
Custom 19,20.png,Structure Not Safe,icon_name_20
|
35
|
+
Custom 20,21.png,Extra 21,icon_name_21
|
36
|
+
Custom 21,22.png,Extra 22,icon_name_22
|
37
|
+
Custom 22,23.png,Extra 23,icon_name_23
|
38
|
+
Residence,default.png,Default,icon_name_24
|
39
|
+
|
40
|
+
Table of Colors (Name/KML Hex)
|
41
|
+
COLORS
|
42
|
+
DarkRed,f0000080
|
43
|
+
Yellow,f000ffff
|
44
|
+
Blue,f0ff0000
|
45
|
+
Red,f01400ff
|
46
|
+
Orange,f014b4ff
|
47
|
+
Green,f000b414
|
48
|
+
Purple,f0ff7878
|
49
|
+
Pink,f0ff78f0
|
50
|
+
|
51
|
+
Switch for Using Constant Color ('true' for one color, 'false' for iteration)
|
52
|
+
USE_CONSTANT_COLOR
|
53
|
+
false
|
54
|
+
|
55
|
+
The color to use if the constant color switch is flipped (must be a key from the colors table)
|
56
|
+
CONSTANT_COLOR
|
57
|
+
Blue
|
data/harness.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
# require 'gpx2kml'
|
2
|
+
|
3
|
+
# g = Gpx2kml.new
|
4
|
+
# g.add_files('input/test.gpx')
|
5
|
+
# g.build_kml('30e-5')
|
6
|
+
# g.save('output/test.kml')
|
7
|
+
|
8
|
+
require_relative './lib/tf1_converter'
|
9
|
+
|
10
|
+
require 'fileutils'
|
11
|
+
FileUtils.rm('output/test.zip') if File.exists?('output/test.zip')
|
12
|
+
|
13
|
+
input = File.open('input/test.gpx', 'r')
|
14
|
+
output = File.open('output/test.kml', 'w')
|
15
|
+
TF1Converter::Config.load('example/localconfig.csv')
|
16
|
+
TF1Converter::Translation.from(input).into(output)
|