simple-trail 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/simple_trail/parser/extract_points.rb +28 -3
- data/simple-trail.gemspec +1 -1
- data/spec/examples/luk_karpat.gpx +292480 -0
- data/spec/parser/large_gpx_spec.rb +11 -0
- metadata +5 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 01fc41a9ee4029834332f22d8cc513e8b12e2d8490e91b144cdd10c9b04f8bab
|
4
|
+
data.tar.gz: 841468837b2f944c7825751b6ddee2d174caa2d4bc4b1e4933664969ef7e5b79
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 46b758ae075b90f1694c4ccb5a48926fefc835f274f0f62014e13f9c792f6c41e306e0fc39d36621f21f700f601f3b4d5652835bbac942891c7c9c1bfbef7406
|
7
|
+
data.tar.gz: e3dbb0f40a6f2b31b81f0e5be17762689ff4fcf08b57618bdcc1210c30d03df8fad70c278a94714551548123301c1ca6109756fce066296d2ba9ef7f1fa9a416
|
@@ -9,9 +9,34 @@ module Parser
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def read_points
|
12
|
-
|
13
|
-
|
14
|
-
|
12
|
+
|
13
|
+
main_node = @parsed_file.fetch(:trk)
|
14
|
+
|
15
|
+
if main_node.is_a?(Array)
|
16
|
+
@simplified_points = []
|
17
|
+
@points = []
|
18
|
+
|
19
|
+
main_node.each do |segment|
|
20
|
+
@simplified_points << simplified_points_selection(segment)
|
21
|
+
@points << segment_points_selection(segment)
|
22
|
+
end
|
23
|
+
|
24
|
+
@simplified_points.flatten!
|
25
|
+
@points.flatten!
|
26
|
+
else
|
27
|
+
segments = main_node.fetch(:trkseg)
|
28
|
+
@points = segments.is_a?(Array) ? segments.map { |seg| seg[:trkpt] }.flatten : segments[:trkpt]
|
29
|
+
@simplified_points = @points.map { |point| point.select { |key, _| [:lon, :lat].include? key } }
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def segment_points_selection(segment)
|
34
|
+
segments = segment.fetch(:trkseg)
|
35
|
+
segments.is_a?(Array) ? segments.map { |seg| seg[:trkpt] }.flatten : segments[:trkpt]
|
36
|
+
end
|
37
|
+
|
38
|
+
def simplified_points_selection(segment)
|
39
|
+
segment_points_selection(segment).map { |point| point.select { |key, _| [:lon, :lat].include? key } }
|
15
40
|
end
|
16
41
|
end
|
17
42
|
end
|
data/simple-trail.gemspec
CHANGED
@@ -5,7 +5,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = 'simple-trail'
|
8
|
-
s.version = '0.3.
|
8
|
+
s.version = '0.3.2'
|
9
9
|
s.date = '2020-08-03'
|
10
10
|
s.summary = 'Readind and manipulating GPX and other trail representation file'
|
11
11
|
s.description = 'Optimazing and manipulating GPX file data. For my private purposes mostly'
|