Part of #1002.
Problem
Elevation gain is missing on essentially the entire catalog. A 400-trail sample across production (offsets 0, 60k, 200k, 400k of 596,556) found 0 with elevation gain; the first 200 in the default ordering had 8. So a trail page reads "Not recorded" where the number a hiker checks second, after distance, belongs — and every derived thing is wrong with it (see the difficulty issue below).
Why this is tractable
The machinery is already here:
climbAlong()inapp/Support/routing.tsturns a polyline into gain and loss in feet, via Valhalla's elevation service, resampling the path first.GET /api/geo/climbalready exposes it for drawn routes.- Every trail already stores
geometry, which is the input that needs. RepairTrailDistancesandRequeueTrailShardsinapp/Commands/are the precedent for a sharded repair pass over the catalog.
So this is a batch job over existing data with an existing function, not new capability.
Acceptance
- A repair command that walks the catalog in shards and fills
elevationfromgeometry, resumable and safe to re-run. - Trails whose geometry is missing or too short to sample are left null rather than written as 0 — "Not recorded" is honest, "0 ft" is not.
- Rate-limited against our Valhalla instance, with the public fallback path unchanged.
elevation_highfilled in the same pass where the sampled heights give it.- Coverage reported at the end, so we can see what it actually achieved rather than assume.
- A test over a known polyline pinning gain against a hand-checked value.