Offline routing phase 2: route panel, /api/route via Valhalla, vehicle profile, save a route to the library

This commit is contained in:
randy committed 2026-11-13 22:34:47 +01:00
1 parent d93c77727f
commit 3146478c23
11 files changed
+577 -12

No files matched your search

+19 -11
View File
@@ -2,7 +2,7 @@
:toc:
:toclevels: 1
Status: *phase 1 implemented* (the container, builds, status in the Offline data panel); phases 2–3 proposed.
Status: *phases 1–2 implemented* (the container and builds; the route panel, vehicle profile and saving a route); phase 3 proposed.
== Goal
@@ -128,16 +128,24 @@ serving swaps the tiles in, and a truck route with dimensions comes back.
three. A routing request made while the offline map is still
downloading extracts waits for it (`Routing.offline_build_finished`).
The row says whether the service answers.
* `POST /api/route` proxies to Valhalla `/route` with `costing: truck`
and the vehicle profile filled in. It's open to everyone, like the
map. Login is required only to save the result.
* Vehicle profile: height, width, length, weight. Stored server-side,
one for now, editable in the route panel.
* Route panel: start, end and via points (map click, search result, GPS
position, a library point), the route drawn with distance, time and
turn list. "Save to library" stores it as a `route` item, so the
route goes to OsmAnd/Locus through the same export as everything
else.
* `POST /api/route` (`{"locations": [[lon, lat], ...]}`) proxies to
Valhalla `/route` and returns the route as a GeoJSON line with
distance, time and turn instructions. It's open to everyone, like the
map; only saving needs a login. The costing depends on the weight:
up to 3.5 t it's `auto` with the vehicle's height and width, because a
camper shouldn't be kept off roads closed to lorries (`hgv=no`). Above
3.5 t it's `truck` with every dimension.
* Vehicle profile: height, width, length, weight in `data/vehicle.json`
(`GET`/`PUT /api/vehicle`), one for now, edited in the route panel.
The default is a camper: 3.0 m, 2.3 m, 7 m, 3.5 t.
* Route panel (`public/js/route.js`): while it's open, a map click adds a
point; markers drag; Reverse, Clear. The route is drawn with distance,
time and directions. "Save to library" stores it as a `route` item in
the "Routes" folder through the notes endpoint, with its points (`via`)
and vehicle in `properties`. That way it goes to OsmAnd/Locus through
the same export as everything else.
* Not yet: adding a point from search, GPS or a library point; reordering
points; editing a saved route again.
== Phases