gpx2exif 0.0.2 → 0.0.3
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/README.md +15 -1
- data/VERSION +1 -1
- data/bin/generate_garmin_waypoints +27 -3
- data/lib/garmin_utils/waypoint_list_generator.rb +49 -27
- metadata +17 -17
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
gpx2exif
|
2
2
|
=======
|
3
3
|
|
4
4
|
Geotagging
|
@@ -49,7 +49,21 @@ How to use it
|
|
49
49
|
|
50
50
|
generate_garmin_waypoints -y input_file.yml > output.gpx
|
51
51
|
|
52
|
+
4. You can check inter-POI distances using
|
52
53
|
|
54
|
+
generate_garmin_waypoints -y input_file.yml -C
|
55
|
+
|
56
|
+
Distance conflict does not mean something is wrong. POIs can be close to each other so it
|
57
|
+
is a good idea to have your brain turned on ;)
|
58
|
+
|
59
|
+
5. You can change inter-POI distances using 'latlon something' distance for distance checking
|
60
|
+
explained line before.
|
61
|
+
|
62
|
+
generate_garmin_waypoints -y samples/sample_yaml_pois.yml -C -t 1
|
63
|
+
|
64
|
+
6. You can specify output file if you don't like using >> 'file.gpx'.
|
65
|
+
|
66
|
+
generate_garmin_waypoints -y samples/sample_yaml_pois.yml -o file.gpx
|
53
67
|
|
54
68
|
Contributing to gpx2xif
|
55
69
|
-------------------------------
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.3
|
@@ -4,19 +4,43 @@ require 'rubygems'
|
|
4
4
|
require 'gpx2exif'
|
5
5
|
require 'optparse'
|
6
6
|
|
7
|
-
options = {}
|
7
|
+
options = { }
|
8
8
|
OptionParser.new do |opts|
|
9
9
|
opts.banner = "Usage: generate_garmin_waypoints [options]"
|
10
10
|
|
11
11
|
opts.on("-y", "--yaml FILE", "Add points from yaml file") do |v|
|
12
12
|
options[:yaml] = v
|
13
13
|
end
|
14
|
+
opts.on("-C", "--check", "Check distance of waypoints") do
|
15
|
+
options[:check] = true
|
16
|
+
end
|
17
|
+
opts.on("-t", "--check_threshold DISTANCE", "Min distance of waypoints") do |v|
|
18
|
+
options[:check_threshold] = v
|
19
|
+
end
|
20
|
+
opts.on("-o", "--output FILE", "Save output to file") do |v|
|
21
|
+
options[:output_file] = v
|
22
|
+
end
|
14
23
|
end.parse!
|
15
24
|
|
16
25
|
g = GarminUtils::WaypointListGenerator.new
|
17
26
|
if options[:yaml]
|
18
|
-
|
27
|
+
g.add_yaml_file(options[:yaml])
|
28
|
+
end
|
29
|
+
if options[:check_threshold]
|
30
|
+
g.check_min_threshold = options[:check_threshold].to_f
|
19
31
|
end
|
20
32
|
|
21
33
|
# result
|
22
|
-
|
34
|
+
if options[:check]
|
35
|
+
g.check
|
36
|
+
else
|
37
|
+
xml = g.to_xml
|
38
|
+
if options[:output_file]
|
39
|
+
f = File.open(options[:output_file], 'w')
|
40
|
+
f.puts xml
|
41
|
+
f.close
|
42
|
+
else
|
43
|
+
puts xml
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
@@ -10,38 +10,57 @@ module GarminUtils
|
|
10
10
|
def initialize
|
11
11
|
@pois = Array.new
|
12
12
|
@etrex_model = "eTrex 30"
|
13
|
+
@check_min_threshold = 0.01
|
13
14
|
end
|
14
15
|
|
16
|
+
attr_accessor :check_min_threshold
|
17
|
+
attr_accessor :etrex_model
|
18
|
+
|
15
19
|
def add_yaml_file(y)
|
16
20
|
@pois += YAML::load_file(y)
|
17
21
|
end
|
18
22
|
|
19
23
|
def add(lat, lon, name, cmt = nil, time = nil, ele = nil, sym = nil)
|
20
24
|
@pois << {
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
25
|
+
:lat => lat,
|
26
|
+
:lon => lon,
|
27
|
+
:name => name,
|
28
|
+
:cmt => cmt,
|
29
|
+
:time => time,
|
30
|
+
:ele => ele,
|
31
|
+
:sym => sym
|
28
32
|
}
|
29
33
|
end
|
30
34
|
|
35
|
+
def check
|
36
|
+
puts "Distance conflicts:"
|
37
|
+
|
38
|
+
sorted = @pois.sort { |p, q| p[:lat] <=> q[:lat] }
|
39
|
+
(1...sorted.size).each do |i|
|
40
|
+
l = (sorted[i-1][:lat] - sorted[i][:lat]) ** 2 +
|
41
|
+
(sorted[i-1][:lon] - sorted[i][:lon]) ** 2
|
42
|
+
l = Math.sqrt(l)
|
43
|
+
|
44
|
+
if l < @check_min_threshold
|
45
|
+
puts "* #{sorted[i-1][:name]} - #{sorted[i][:name]} = #{l}"
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
31
50
|
def to_xml
|
32
51
|
#xml = Builder::XmlMarkup.new(:indent => 2)
|
33
52
|
string = ""
|
34
53
|
xml = Builder::XmlMarkup.new(:target => string, :indent => 0)
|
35
54
|
xml.instruct! :xml, :encoding => "UTF-8", :standalone => 'no'
|
36
55
|
xml.gpx(
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
56
|
+
'xmlns' => "http://www.topografix.com/GPX/1/1",
|
57
|
+
'xmlns:gpxx' => "http://www.garmin.com/xmlschemas/GpxExtensions/v3",
|
58
|
+
'xmlns:wptx1' => "http://www.garmin.com/xmlschemas/WaypointExtension/v1",
|
59
|
+
'xmlns:gpxtpx' => "http://www.garmin.com/xmlschemas/TrackPointExtension/v1",
|
60
|
+
'creator' => @etrex_model,
|
61
|
+
'version' => "1.1",
|
62
|
+
'xmlns:xsi' => "http://www.w3.org/2001/XMLSchema-instance",
|
63
|
+
'xsi:schemaLocation' => "http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd http://www.garmin.com/xmlschemas/GpxExtensions/v3 http://www8.garmin.com/xmlschemas/GpxExtensionsv3.xsd http://www.garmin.com/xmlschemas/WaypointExtension/v1 http://www8.garmin.com/xmlschemas/WaypointExtensionv1.xsd http://www.garmin.com/xmlschemas/TrackPointExtension/v1 http://www.garmin.com/xmlschemas/TrackPointExtensionv1.xsd"
|
45
64
|
|
46
65
|
|
47
66
|
) do |g|
|
@@ -84,21 +103,24 @@ module GarminUtils
|
|
84
103
|
def self.symbols
|
85
104
|
# http://freegeographytools.com/2008/garmin-gps-unit-waypoint-icons-table
|
86
105
|
[
|
87
|
-
|
88
|
-
|
89
|
-
|
106
|
+
"Flag, Blue",
|
107
|
+
"Flag, Green",
|
108
|
+
"Flag, Red",
|
109
|
+
|
110
|
+
"Pin, Blue",
|
111
|
+
"Pin, Green",
|
112
|
+
"Pin, Red",
|
90
113
|
|
91
|
-
|
92
|
-
|
93
|
-
|
114
|
+
"Block, Blue",
|
115
|
+
"Block, Green",
|
116
|
+
"Block, Red",
|
94
117
|
|
95
|
-
|
96
|
-
|
97
|
-
|
118
|
+
"Summit",
|
119
|
+
"Trail Head", # other trail parts, not summits
|
120
|
+
"Lodging", # rooms
|
98
121
|
|
99
|
-
|
100
|
-
|
101
|
-
# ...
|
122
|
+
"Ground Transportation" # all public ground transportation
|
123
|
+
# ...
|
102
124
|
|
103
125
|
]
|
104
126
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gpx2exif
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-04-
|
12
|
+
date: 2012-04-28 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|
16
|
-
requirement: &
|
16
|
+
requirement: &16259820 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *16259820
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: mini_exiftool
|
27
|
-
requirement: &
|
27
|
+
requirement: &16259220 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *16259220
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: builder
|
38
|
-
requirement: &
|
38
|
+
requirement: &16258560 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *16258560
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rspec
|
49
|
-
requirement: &
|
49
|
+
requirement: &16257960 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ~>
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 2.3.0
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *16257960
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: bundler
|
60
|
-
requirement: &
|
60
|
+
requirement: &16257320 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ~>
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: 1.0.0
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *16257320
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: jeweler
|
71
|
-
requirement: &
|
71
|
+
requirement: &16256720 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ~>
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: 1.6.4
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *16256720
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: simplecov
|
82
|
-
requirement: &
|
82
|
+
requirement: &16256120 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ! '>='
|
@@ -87,7 +87,7 @@ dependencies:
|
|
87
87
|
version: '0'
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *16256120
|
91
91
|
description: Mass geotagger using GPX files.
|
92
92
|
email: bobikx@poczta.fm
|
93
93
|
executables:
|
@@ -128,7 +128,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
128
128
|
version: '0'
|
129
129
|
segments:
|
130
130
|
- 0
|
131
|
-
hash:
|
131
|
+
hash: -92745170139221156
|
132
132
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
133
133
|
none: false
|
134
134
|
requirements:
|