Show track properties (distance, elevation gain, duration)
Maptool::TrackStats computes these once, shared by Gpx and Fit so both track feature shapes carry the same properties regardless of source format. Hovering a track line (not clicking — these describe the whole line, not one point) shows them in a popup, same mechanism GPX waypoints already use.
This commit is contained in:
1 parent
fc174d4267
commit
a3c31ace06
5 files changed
+172
-21
No files matched your search
@@ -233,6 +233,23 @@ assembling any HTML; the URL pattern excludes quote characters, so a
|
||||
matched URL can never break out of the `href="..."` attribute. Every
|
||||
other value is HTML-escaped before being handed to `Popup#setHTML`.
|
||||
|
||||
Track properties:: Every track feature (both formats) also carries
|
||||
`distance_meters`, `elevation_gain_meters`, `duration_secs` and
|
||||
`point_count`, computed once server-side by `Maptool::TrackStats`
|
||||
(`lib/maptool/track_stats.rb`, shared by `Gpx`/`Fit` so neither
|
||||
duplicates the haversine formula) rather than in the browser — cheap
|
||||
either way, but it means a GPX and a FIT file end up with the same
|
||||
properties shape, so the frontend doesn't need to know which format it
|
||||
got. Distance sums the haversine distance between consecutive points;
|
||||
elevation gain sums only the positive deltas (descents don't
|
||||
subtract); duration is the gap between the first and last known
|
||||
timestamp, skipping unknown ones in between — `nil` for any of these
|
||||
where the source data doesn't have enough to compute it (e.g. a GPX
|
||||
file with no `<time>` elements has `duration_secs: nil`). Hovering a
|
||||
track line (rather than clicking, unlike a waypoint — these properties
|
||||
describe the whole line, not whichever point the cursor happens to be
|
||||
over) shows them in the same popup mechanism.
|
||||
|
||||
== Live GNSS position
|
||||
|
||||
A "GNSS" map control (`public/js/gnss.js`) shows the fix from a local
|
||||
|
||||
Reference in new issue
Block a user