
Trava
A Rust route engine that turns any drawing or text into a walkable loop on real streets, with a React Native app to plan and record it.
RustTypeScriptExpoReact
- Street data comes from OpenStreetMap through Overpass (with mirror failover and an on-disk cache) and is built into an intersection graph, keeping the largest connected component.
- A coarse-to-fine search tries about 10,000 placements of the shape (rotation, offset, scale), ranks them with a cheap proxy, and fully routes the top 16.
- Routes are snapped to roads with HMM map-matching (Viterbi), connected with a bounded Dijkstra that penalizes drifting from the drawing, and scored by Fréchet distance and mean deviation.
- Profiling showed nearest-segment lookups were the bottleneck. A grid spatial index with early-exit ring search plus rayon parallelism cut Paris (62K nodes) from 15 s to 2 s and the median route from 5.4 s to under 200 ms.
- Across a benchmark of 84 routes in 7 cities, every route succeeds with a 14.9 m median deviation from the drawing and under 1% length error.
- An axum server runs planning as async jobs on a semaphore-bounded worker pool and streams improving previews over Server-Sent Events. A generated OpenAPI spec feeds a typed TypeScript client. 39 Rust tests.