feat(train): routes out and in as GPX (ADR 0030, D45)

A route's page shares it as GPX 1.1 (Android's share sheet, else saved
where the person chooses): its way a track with elevations, its
waypoints and turns as named points. A GPX file comes in from the Routes
tab or, on Android, opened with Train or shared to it; it is planned
along the paths through its points or kept as drawn, then named and
saved as a new route.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Tizian 「ティツィアーン」 <raisondetredev@pm.me>
This commit is contained in:
Tizian 「ティツィアーン」 2026-10-29 10:44:47 +01:00
commit 5ff9b2e053
Signed by: raisondetredev
GPG key ID: 07F6FCF405488B64

View file

@ -944,6 +944,26 @@ Strava. What was found, 27 Oct:
kept, since it is the saved way that is kept. Not done: a size limit or a warning
before a long route's download (a 200 km ride at OpenFreeMap's zooms is some 700
tiles, a few tens of MB), and keeping a map only on Wi-Fi.
Built: GPX out and in (9d's second half). A route's page hands it on as GPX 1.1
(`gpx.dart`): on Android to the share sheet (`RouteFiles.kt`, through a FileProvider
that shares only the one file written for it, in the cache's `shared/`), elsewhere
saved where the person chooses (halkyon_app's `FileSaver`); its way as a track with
the elevations, its waypoints as `wpt` of the type `waypoint` and its turns as `wpt`
of the type `turn`, named in the app's language (beelines left out), which CoMaps
and others show as points along the track. Routes come in from *Bring in a GPX
file* in the Routes tab (file_selector's dialog, as Learn's) and, on Android, from a
GPX file opened with Train or shared to it (by the type `application/gpx+xml` where
the sender names it, by a name ending `.gpx` where it says only that it is a file;
at most 20 MB, a file arriving before the app listens kept until it does). Any
version of GPX is read: the first track, its segments joined, else the first
route; elevations only where every point has one. The person then chooses: *Plan
it along the paths*, through Train's own waypoints where the file is Train's, a
route's points where it has a track as well, else up to 50 points spread along the
way at least a kilometre apart, planned at once with the running profile (changed
on the page, which plans it again); or *Keep it as drawn*, the file's way with its
distance and climb worked out as a recording's (climbs above 3 m), no turns told.
Either opens as a new route to be named and saved; a drawn route that is changed
is planned along the paths from then on. A file without a route says so.
- **D46 Train's server on the instance** (recommended, the developer's; 28 Oct): it
joins learn.halkyon.eu's server, as BRouter needs a server of Train's to ask it
(D11, D22), at **train.halkyon.eu** (over a path on learn.halkyon.eu, which would