Planning truck routes with the weather at arrival time
By Hifsul · 2026-11-16 · 2 min read
Weather on a route matters at the moment the truck gets there, not at departure. This tool takes an origin, a destination, a departure time, the load weight and a checkpoint spacing, builds three genuinely different routes, and rates each one against the forecast at every checkpoint's arrival time.
Three routes that are actually different
Routes come from Valhalla with truck costing, falling back to OSRM. Routing engines often return near-identical alternatives, so routes that overlap 85% or more are dropped and replaced by detours through sideways waypoints. Any detour more than 60% slower than the fastest route is rejected, because nobody will drive it.
Forecast at the ETA, not at departure
Each checkpoint gets an ETA interpolated along the route, and the hourly forecast is interpolated to that exact time. Each checkpoint is rated by the worst of wind, rain and snow. Load rules can raise the wind rating: for example, 45 to 54 mph with more than 30,000 lb is No Travel.
Ranking that a driver can understand
Routes are ranked by miles of No Travel, Severe and High risk, then by average risk and duration. The recommended route comes with a plain-English reason, and a 0 to 48 hour risk heatmap of the corridor loads in the background, with all 49 frames in one response.
Keeping it fast and polite to free APIs
- Upstream calls are cached by key: routes for 1 hour, weather for 30 minutes, geocoding for 24 hours.
- Checkpoints are rounded to about 1 km, so nearby points share a forecast.
- If the weather API rate-limits the server, the browser can fetch it instead, with checks on the server.
- Valhalla fails over to OSRM, with clear 502/503 errors when both are down.
34 backend tests cover risk bands, ranking, ETAs and fallbacks. The source code is public on GitHub.