gpx_doctor 0.6.1 → 0.6.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 62f11c008dcbf53c4585d1cc1d4935555ddecbfc98ce4db4f0141476f2847ce3
4
- data.tar.gz: ebf37bed3a22db9e84a6a0d1b593f2e3f9e9bf0146f114a06d8b900cc2e853f8
3
+ metadata.gz: '08f52b7255e18952f838ad2b348a8df20059212c1ef8109d19d09d2ac7a9eb64'
4
+ data.tar.gz: 9ad7a941a8e3fa217560e9bf2acc64984ffe33cdb4b639e1288a027a5d8f8714
5
5
  SHA512:
6
- metadata.gz: b096d0f32832c3ecd0147bd5b6066dd18f1fd19233af68101d486b5a4895febb2228da30fd907b849436a1feaca98bc707cfd2a0963b05b0587962d11a803f85
7
- data.tar.gz: 5cf20d498a2247483904a86ca637bff0cc527bafe74f7c312d869694ef05fa798f675940f536980240eab12a90034bed42e841bcc6056bf43fb5505484baddc8
6
+ metadata.gz: f0ba58080565539a3d32e89cfb17f26b8712205e3f62a47dbcb03a61bdac557b3e46b36b634249fc5dd24422f137a8afebddeaed127b908a5d94123ec8a58b17
7
+ data.tar.gz: 523325873b587abd8a951d72d3ef9ec4ec26b5b996ddd2b86518e2c9a4e4fd50fdb7a1beed9d932f91390822ab56c670ef1f701a8f9de90fb98232c3226c9dcf
data/README.md CHANGED
@@ -116,19 +116,28 @@ Processing is applied in the following order:
116
116
  ## Accessing data
117
117
 
118
118
  ```ruby
119
- result.points # => [#<Waypoint lat=…, lon=…, ele=…>, …] (all geographic points)
120
- result.waypoints # => [#<Waypoint …>] (top-level <wpt> elements only)
121
- result.routes # => [#<Route …>]
122
- result.tracks # => [#<Track …>]
123
- result.metadata # => #<Metadata …> (or nil)
124
- result.pois # => Hash (only when parsed with full_poi_data: true, otherwise nil)
119
+ result.points # => [#<Waypoint lat=…, lon=…, ele=…>, …] (the path)
120
+ result.all_points # => [#<Waypoint …>, …] (the path plus standalone waypoints)
121
+ result.waypoints # => [#<Waypoint …>] (top-level <wpt> elements only)
122
+ result.routes # => [#<Route …>]
123
+ result.tracks # => [#<Track …>]
124
+ result.metadata # => #<Metadata …> (or nil)
125
+ result.pois # => Hash (only when parsed with full_poi_data: true, otherwise nil)
125
126
  ```
126
127
 
127
- `result.points` is a flat array containing **all** geographic points from:
128
- - Top-level `<wpt>` elements
128
+ `result.points` is a flat array describing **the path**, in order:
129
129
  - `<rtept>` elements inside each `<rte>`
130
130
  - `<trkpt>` elements inside each `<trkseg>` inside each `<trk>`
131
131
 
132
+ Top-level `<wpt>` elements are **not** included. They are points of interest that may
133
+ sit anywhere on — or off — the path, and exporters list them in file order rather than
134
+ path order, so treating them as path points draws straight lines back and forth across
135
+ the map. Read them from `result.waypoints`, or use `result.all_points` (standalone
136
+ waypoints first, then the path) when you genuinely want every geographic point in the
137
+ file. All processing params (`max_points`, `cumulative_distance`, `label_interval`,
138
+ `segment_statistics`, `full_poi_data`) operate on the path only; `enhance_elevation` is
139
+ the exception and fills in elevations for standalone waypoints too.
140
+
132
141
  ### `result.pois`
133
142
 
134
143
  When parsed with `full_poi_data: true`, `result.pois` contains boundary data for the entire GPX and each track segment:
@@ -8,8 +8,25 @@ module GpxDoctor
8
8
  GPX_NS = 'http://www.topografix.com/GPX/1/1'
9
9
 
10
10
  Result = Struct.new(:waypoints, :routes, :tracks, :metadata, :pois, keyword_init: true) do
11
+ # The path described by the file, in order: <rtept> then <trkpt>.
12
+ #
13
+ # Standalone <wpt> elements are deliberately NOT part of it. They are
14
+ # points of interest scattered anywhere on (or off) the path — exporters
15
+ # such as komoot emit them for highlights like bridges or churches — so
16
+ # folding them in front of the path turns a valid route into a zig-zag of
17
+ # straight lines back and forth across the whole map. Every other stage of
18
+ # the gem (split_segments, select_max_points, enhance_statistics,
19
+ # enhance_cumulative_distance, label_points, build_pois) already walks
20
+ # routes and track segments only; this makes #points agree with them.
21
+ #
22
+ # Use #all_points for every geographic point in the file, waypoints included.
11
23
  def points
12
- waypoints + routes.flat_map(&:points) + tracks.flat_map(&:points)
24
+ routes.flat_map(&:points) + tracks.flat_map(&:points)
25
+ end
26
+
27
+ # Every geographic point in the file: standalone waypoints followed by the path.
28
+ def all_points
29
+ waypoints + points
13
30
  end
14
31
  end
15
32
 
@@ -224,7 +241,9 @@ module GpxDoctor
224
241
  config = GpxDoctor.configuration
225
242
  return unless config.elevation_server && config.elevation_server_url
226
243
 
227
- ElevationClient.new.enhance(result.points)
244
+ # all_points, not points: standalone waypoints are POIs the caller still
245
+ # wants an elevation for, even though they are not part of the path.
246
+ ElevationClient.new.enhance(result.all_points)
228
247
  end
229
248
 
230
249
  def effective_max_distance(result)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module GpxDoctor
4
- VERSION = '0.6.1'
4
+ VERSION = '0.6.2'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gpx_doctor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.1
4
+ version: 0.6.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Poltrax