comtec-dr 0.7.0 → 0.8.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_csv_to_gps +29 -0
- data/exe/comtec_mov_demux +2 -2
- data/exe/comtec_mov_to_csv +4 -4
- data/exe/comtec_mov_to_gpx +6 -5
- data/lib/comtec-dr/gps_log.rb +57 -55
- data/lib/comtec-dr/gpx_generator.rb +10 -1
- data/lib/comtec-dr/udat_analyzer.rb +1 -1
- data/lib/comtec-dr/version.rb +1 -1
- metadata +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 80e24446a1bc5937c236b7a810ee53533695692e
|
4
|
+
data.tar.gz: 76ae164fedf54aa09230b970b798e1128cd2ac2a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 87611f1a944be3c93b6d7c353f47241024fb09c7ef9b72b6a428814e55ce01709de7d435fe73fc025560a549227564e8f3b695a298e631744dac7f83d0f71bad
|
7
|
+
data.tar.gz: 79f3d0e2c1991da3bef41180b5340a318f8f65087b816def1826ca26e2e5699c3d3769ae52ef4efe025aea6095922516bfa0f2c1058a6d12d6bc7e6a5feae5f8
|
@@ -0,0 +1,29 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'pathname'
|
5
|
+
require 'csv'
|
6
|
+
require 'comtec-dr'
|
7
|
+
|
8
|
+
ARGV.each do |arg|
|
9
|
+
path = Pathname arg
|
10
|
+
if path.file? && path.basename.to_s.end_with?('.csv')
|
11
|
+
gpx = ComtecDR::GpxGenerator.new "#{path.basename.to_s.gsub('.csv','')}.gpx"
|
12
|
+
csv = CSV.read path.to_s
|
13
|
+
gpx.add_track csv
|
14
|
+
gpx.write
|
15
|
+
elsif path.directory?
|
16
|
+
gpx = ComtecDR::GpxGenerator.new "#{path.basename.to_s}.gpx"
|
17
|
+
csvs = []
|
18
|
+
path.children.each do |child_path|
|
19
|
+
if child_path.file? && child_path.basename.to_s.end_with?('.csv')
|
20
|
+
csv = CSV.read child_path.to_s
|
21
|
+
csvs << csv
|
22
|
+
end
|
23
|
+
end
|
24
|
+
csvs.each do |csv|
|
25
|
+
gpx.add_track csv
|
26
|
+
end
|
27
|
+
gpx.write
|
28
|
+
end
|
29
|
+
end
|
data/exe/comtec_mov_demux
CHANGED
data/exe/comtec_mov_to_csv
CHANGED
@@ -1,16 +1,16 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require
|
3
|
+
require 'bundler/setup'
|
4
4
|
require 'pathname'
|
5
5
|
require 'csv'
|
6
|
-
require
|
6
|
+
require 'comtec-dr'
|
7
7
|
|
8
8
|
ARGV.each do |arg|
|
9
9
|
path = Pathname arg
|
10
10
|
if path.file? && path.basename.to_s.end_with?('.MOV')
|
11
11
|
CSV.open("#{path.basename.to_s.gsub('.MOV','')}.csv",'w') do |csv|
|
12
12
|
ComtecDR::UdatAnalyzer.analyze(ComtecDR::MovDemuxer.demux path.to_s).each do |line|
|
13
|
-
log = GpsLog.new *line
|
13
|
+
log = ComtecDR::GpsLog.new *line
|
14
14
|
csv << [*log.csv_line, path.basename.to_s]
|
15
15
|
end
|
16
16
|
end
|
@@ -19,7 +19,7 @@ ARGV.each do |arg|
|
|
19
19
|
path.children.each do |child_path|
|
20
20
|
if child_path.file? && child_path.basename.to_s.end_with?('.MOV')
|
21
21
|
ComtecDR::UdatAnalyzer.analyze(ComtecDR::MovDemuxer.demux child_path.to_s).each do |line|
|
22
|
-
log = GpsLog.new *line
|
22
|
+
log = ComtecDR::GpsLog.new *line
|
23
23
|
csv << [*log.csv_line, child_path.basename.to_s]
|
24
24
|
end
|
25
25
|
end
|
data/exe/comtec_mov_to_gpx
CHANGED
@@ -1,25 +1,26 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require
|
3
|
+
require 'bundler/setup'
|
4
4
|
require 'pathname'
|
5
|
-
require
|
5
|
+
require 'comtec-dr'
|
6
6
|
|
7
7
|
ARGV.each do |arg|
|
8
8
|
path = Pathname arg
|
9
9
|
if path.file? && path.basename.to_s.end_with?('.MOV')
|
10
10
|
gpx = ComtecDR::GpxGenerator.new "#{path.basename.to_s.gsub('.MOV','')}.gpx"
|
11
11
|
csv = ComtecDR::UdatAnalyzer.analyze(ComtecDR::MovDemuxer.demux path.to_s).map do |line|
|
12
|
-
log = GpsLog.new *line
|
12
|
+
log = ComtecDR::GpsLog.new *line
|
13
13
|
log.csv_line
|
14
14
|
end
|
15
|
-
gpx.
|
15
|
+
gpx.add_track csv
|
16
16
|
gpx.write
|
17
17
|
elsif path.directory?
|
18
18
|
gpx = ComtecDR::GpxGenerator.new "#{path.basename.to_s}.gpx"
|
19
|
+
gpx.add_track
|
19
20
|
path.children.each do |child_path|
|
20
21
|
if child_path.file? && child_path.basename.to_s.end_with?('.MOV')
|
21
22
|
csv = ComtecDR::UdatAnalyzer.analyze(ComtecDR::MovDemuxer.demux child_path.to_s).map do |line|
|
22
|
-
log = GpsLog.new *line
|
23
|
+
log = ComtecDR::GpsLog.new *line
|
23
24
|
log.csv_line
|
24
25
|
end
|
25
26
|
gpx.add_trkseg csv
|
data/lib/comtec-dr/gps_log.rb
CHANGED
@@ -1,57 +1,59 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
1
|
+
module ComtecDR
|
2
|
+
class GpsLog
|
3
|
+
def initialize lat, lat_s, lon, lon_s, speed, jst, msec, x_a, y_a, z_a
|
4
|
+
@lat = lat
|
5
|
+
@lat_sign = lat_s
|
6
|
+
@lon = lon
|
7
|
+
@lon_sign = lon_s
|
8
|
+
@speed = speed
|
9
|
+
@jst = jst
|
10
|
+
@msec = msec
|
11
|
+
@x_acceleration = x_a
|
12
|
+
@y_acceleration = y_a
|
13
|
+
@z_acceleration = z_a
|
14
|
+
end
|
15
|
+
|
16
|
+
def lat
|
17
|
+
(dmm_to_dms(@lat) * (@lat_sign == 'N' ? 1 : -1)).to_f
|
18
|
+
end
|
19
|
+
|
20
|
+
def lon
|
21
|
+
(dmm_to_dms(@lon) * (@lon_sign == 'E' ? 1 : -1)).to_f
|
22
|
+
end
|
23
|
+
|
24
|
+
def speed
|
25
|
+
@speed.to_i
|
26
|
+
end
|
27
|
+
|
28
|
+
def jst
|
29
|
+
Time.parse "20#{@jst}}+0900"
|
30
|
+
end
|
31
|
+
|
32
|
+
def msec
|
33
|
+
@msec.to_i
|
34
|
+
end
|
35
|
+
|
36
|
+
def x_acceleration
|
37
|
+
@x_acceleration.to_f/1000
|
38
|
+
end
|
39
|
+
|
40
|
+
def y_acceleration
|
41
|
+
@y_acceleration.to_f/1000
|
42
|
+
end
|
43
|
+
|
44
|
+
def z_acceleration
|
45
|
+
@z_acceleration.to_f/1000
|
46
|
+
end
|
47
|
+
|
48
|
+
def csv_line
|
49
|
+
[lat, lon, speed, jst, msec, x_acceleration, y_acceleration, z_acceleration]
|
50
|
+
end
|
51
|
+
|
52
|
+
private
|
53
|
+
# DMM形式から変換
|
54
|
+
def dmm_to_dms str
|
55
|
+
number, fractional = str.split('.')
|
56
|
+
number[0...-2].to_r + "#{number[-2..-1]}.#{fractional}".to_r / 60
|
57
|
+
end
|
56
58
|
end
|
57
59
|
end
|
@@ -13,9 +13,19 @@ module ComtecDR
|
|
13
13
|
'xsi:schemaLocation' => 'http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd'
|
14
14
|
})
|
15
15
|
@doc.add_element(@gpx)
|
16
|
+
end
|
16
17
|
|
18
|
+
def add_track csv = nil
|
17
19
|
@trk = REXML::Element.new('trk')
|
18
20
|
@gpx.add_element(@trk)
|
21
|
+
|
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 if !csv.nil?
|
19
29
|
end
|
20
30
|
|
21
31
|
def add_trkseg csv
|
@@ -28,7 +38,6 @@ module ComtecDR
|
|
28
38
|
end
|
29
39
|
end
|
30
40
|
|
31
|
-
|
32
41
|
def write
|
33
42
|
File.open(@filename, 'w') do |file|
|
34
43
|
@doc.write(file, indent=2)
|
data/lib/comtec-dr/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: comtec-dr
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shogo Kawaguchi
|
@@ -56,6 +56,7 @@ description: comtec drive recorder analyzer
|
|
56
56
|
email:
|
57
57
|
- platycod0n.ramosa@gmail.com
|
58
58
|
executables:
|
59
|
+
- comtec_csv_to_gps
|
59
60
|
- comtec_mov_demux
|
60
61
|
- comtec_mov_to_csv
|
61
62
|
- comtec_mov_to_gpx
|
@@ -71,6 +72,7 @@ files:
|
|
71
72
|
- bin/console
|
72
73
|
- bin/setup
|
73
74
|
- comtec-dr.gemspec
|
75
|
+
- exe/comtec_csv_to_gps
|
74
76
|
- exe/comtec_mov_demux
|
75
77
|
- exe/comtec_mov_to_csv
|
76
78
|
- exe/comtec_mov_to_gpx
|