comtec-dr 0.3.0 → 0.4.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.
- checksums.yaml +4 -4
- data/exe/{comtec_mov_extract_csv → comtec_mov_to_csv} +0 -0
- data/exe/comtec_mov_to_gpx +33 -0
- data/lib/comtec-dr.rb +2 -1
- data/lib/comtec-dr/gps_log.rb +7 -3
- data/lib/comtec-dr/gpx_generator.rb +38 -0
- data/lib/comtec-dr/version.rb +1 -1
- metadata +7 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 13877684972454db0a5b1d1e7e6d9c55caf802ce
|
4
|
+
data.tar.gz: 7e459b43420eb05da8dd959850f38c8a8bea83ff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cea2197e32e8c2d5b2f6e03aac6f98ced5e3add087e2f45ec0123eb2cb9dbfdf2d8496f49db69aa01aba13d86c15027690965b20b776676436e9900653be6e81
|
7
|
+
data.tar.gz: fe8b364b3314f3051e6af17b1d7a38f70e168cb8842380180f4851999886a68219985dd5d8554ddfe4d3758098f2f2ceac8b35b7536d7c4d176a4ab31e971bd4
|
File without changes
|
@@ -0,0 +1,33 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require 'pathname'
|
5
|
+
require "comtec-dr"
|
6
|
+
|
7
|
+
data = []
|
8
|
+
|
9
|
+
ARGV.each do |arg|
|
10
|
+
path = Pathname arg
|
11
|
+
if path.file? && path.basename.to_s.end_with?('.MOV')
|
12
|
+
|
13
|
+
gpx = ComtecDR::GpxGenerator.new "#{path.basename.to_s}.gpx"
|
14
|
+
csv = ComtecDR::UdatAnalyzer.analyze(ComtecDR::MovDemuxer.demux path.to_s).map do |line|
|
15
|
+
log = GpsLog.new *line
|
16
|
+
log.csv_line
|
17
|
+
end
|
18
|
+
gpx.add_trkseg csv
|
19
|
+
gpx.write
|
20
|
+
elsif path.directory?
|
21
|
+
gpx = ComtecDR::GpxGenerator.new "#{path.basename.to_s}.gpx"
|
22
|
+
path.children.each do |child_path|
|
23
|
+
if child_path.file? && child_path.basename.to_s.end_with?('.MOV')
|
24
|
+
csv = ComtecDR::UdatAnalyzer.analyze(ComtecDR::MovDemuxer.demux child_path.to_s).map do |line|
|
25
|
+
log = GpsLog.new *line
|
26
|
+
log.csv_line
|
27
|
+
end
|
28
|
+
gpx.add_trkseg csv
|
29
|
+
end
|
30
|
+
end
|
31
|
+
gpx.write
|
32
|
+
end
|
33
|
+
end
|
data/lib/comtec-dr.rb
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
require "time"
|
2
|
+
require 'rexml/document'
|
2
3
|
require "comtec-dr/version"
|
3
4
|
require "comtec-dr/gps_log"
|
4
5
|
require "comtec-dr/mov_demuxer"
|
5
6
|
require "comtec-dr/udat_analyzer"
|
7
|
+
require "comtec-dr/gpx_generator"
|
6
8
|
|
7
9
|
module ComtecDR
|
8
|
-
# Your code goes here...
|
9
10
|
end
|
data/lib/comtec-dr/gps_log.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
class GpsLog
|
2
|
-
def initialize lat, lat_s, lon, lon_s, speed, jst,
|
2
|
+
def initialize lat, lat_s, lon, lon_s, speed, jst, msec, x_a, y_a, z_a
|
3
3
|
@lat = lat
|
4
4
|
@lat_sign = lat_s
|
5
5
|
@lon = lon
|
6
6
|
@lon_sign = lon_s
|
7
7
|
@speed = speed
|
8
8
|
@jst = jst
|
9
|
-
@
|
9
|
+
@msec = msec
|
10
10
|
@x_acceleration = x_a
|
11
11
|
@y_acceleration = y_a
|
12
12
|
@z_acceleration = z_a
|
@@ -28,6 +28,10 @@ class GpsLog
|
|
28
28
|
Time.parse "20#{@jst}}+0900"
|
29
29
|
end
|
30
30
|
|
31
|
+
def msec
|
32
|
+
@msec.to_i
|
33
|
+
end
|
34
|
+
|
31
35
|
def x_acceleration
|
32
36
|
@x_acceleration.to_f/10000
|
33
37
|
end
|
@@ -41,7 +45,7 @@ class GpsLog
|
|
41
45
|
end
|
42
46
|
|
43
47
|
def csv_line
|
44
|
-
[lat, lon, speed, jst, x_acceleration, y_acceleration, z_acceleration]
|
48
|
+
[lat, lon, speed, jst, msec, x_acceleration, y_acceleration, z_acceleration]
|
45
49
|
end
|
46
50
|
|
47
51
|
private
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module ComtecDR
|
2
|
+
class GpxGenerator
|
3
|
+
def initialize filename
|
4
|
+
@filename = filename
|
5
|
+
@doc = REXML::Document.new
|
6
|
+
@gpx = REXML::Element.new('gpx')
|
7
|
+
|
8
|
+
@gpx.add_attributes({
|
9
|
+
'creator' => "comtec-dr-ruby/#{ComtecDR::VERSION}",
|
10
|
+
'version' => "1.1",
|
11
|
+
'xmlns' => 'http://www.topografix.com/GPX/1/1',
|
12
|
+
'xmlns:xsi' => 'http://www.w3.org/2001/XMLSchema-instance',
|
13
|
+
'xsi:schemaLocation' => 'http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd'
|
14
|
+
})
|
15
|
+
@doc.add_element(@gpx)
|
16
|
+
|
17
|
+
@trk = REXML::Element.new('trk')
|
18
|
+
@gpx.add_element(@trk)
|
19
|
+
end
|
20
|
+
|
21
|
+
def add_trkseg csv
|
22
|
+
trkseg = REXML::Element.new('trkseg')
|
23
|
+
@trk.add_element(trkseg)
|
24
|
+
csv.each do |line|
|
25
|
+
trkpt = REXML::Element.new('trkpt')
|
26
|
+
trkpt.add_attributes({'lat' => line[0], 'lon' => line[1]})
|
27
|
+
trkseg.add_element(trkpt)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
def write
|
33
|
+
File.open(@filename, 'w') do |file|
|
34
|
+
@doc.write(file, indent=2)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
data/lib/comtec-dr/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: comtec-dr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shogo Kawaguchi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-10-
|
11
|
+
date: 2017-10-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -57,7 +57,8 @@ email:
|
|
57
57
|
- platycod0n.ramosa@gmail.com
|
58
58
|
executables:
|
59
59
|
- comtec_mov_demux
|
60
|
-
-
|
60
|
+
- comtec_mov_to_csv
|
61
|
+
- comtec_mov_to_gpx
|
61
62
|
extensions: []
|
62
63
|
extra_rdoc_files: []
|
63
64
|
files:
|
@@ -71,9 +72,11 @@ files:
|
|
71
72
|
- bin/setup
|
72
73
|
- comtec-dr.gemspec
|
73
74
|
- exe/comtec_mov_demux
|
74
|
-
- exe/
|
75
|
+
- exe/comtec_mov_to_csv
|
76
|
+
- exe/comtec_mov_to_gpx
|
75
77
|
- lib/comtec-dr.rb
|
76
78
|
- lib/comtec-dr/gps_log.rb
|
79
|
+
- lib/comtec-dr/gpx_generator.rb
|
77
80
|
- lib/comtec-dr/mov_demuxer.rb
|
78
81
|
- lib/comtec-dr/udat_analyzer.rb
|
79
82
|
- lib/comtec-dr/version.rb
|