Bike Trip Planner Guide

Back to the planner

A single-file web page for planning long motorcycle rides. You give it a start, a finish and any vias. It works out the route (sealed roads only, if you like), picks stops roughly every 100 km in towns that actually have services, and builds a live trip sheet:

Every change you make on the sheet updates everything below it straight away. The sheet can be copied into Google Sheets or Excel, or downloaded as CSV.

The planner comes as two files:


Getting started

  1. Unzip both files into the same folder, anywhere on your computer. Keep them together.
  2. Open index.html directly in Chrome or Edge: double-click it, or drag it into a browser window.
  3. On the very first open, it plans the example trip so you can see how it works: Melbourne → Mildura → Adelaide → Mount Gambier → Melbourne, with overnights at Mildura (leaving 06:00) and Mount Gambier (leaving 07:00).
  4. The How it works (README) link in the green header, and the one in the footer, open this guide in a new tab. That's why the two files need to be in the same folder. This guide's Back to the planner link opens index.html.

Don't open it inside another app's file preview pane. Preview panes block internet lookups, and the page will say so.

You need an internet connection. There are no accounts, keys or installs.


The Trip panel

Setting What it does
Start / Finish Town, suburb or address. Add the state to avoid mix-ups, e.g. Burnside SA (there is also a Burnside in Victoria). You can also type a latitude and longitude, e.g. -37.70, 145.10. The green text underneath shows what it was matched to.
Via (one per line) Places the route must pass through. Each via becomes a fixed stop on the sheet. Add @ and a time to stay overnight and leave at that local time, e.g. Mildura VIC @ 06:00. The time can also be written @0600, @600, @ 6.00, @6am or @ 5:45 pm. If the time after @ can't be read (e.g. @ 25:00), planning stops and says which via to fix, rather than losing the overnight.
Depart date / time When you leave the start, in the start's local time. Starts out as next Saturday at 11:50.
Stop every (km) Target spacing between stops (default 100, from 30 to 400). Changing it re-picks the stops along the same route, searching any new stretches.
Speed (% of limit) Every leg is timed as if you ride at this percentage of the speed limit (default 95%, from 50 to 120). See Speeds and times below.
Rest stop / Fuel stop / Meal stop Stop lengths in minutes (defaults 5, 15 and 30). A stop with FOOD ticked gets the meal time, a planned fuel stop the fuel time, any other stop the rest time. The planner doesn't choose meal stops; you tick FOOD where you want to eat.
Fuel range (km) How far you will ride between fills (default 300). Any whole number.
Km on tank at start Leave at 0 if you start with a full tank.
Sealed roads only Ticked (the default): the route avoids unsealed roads, using the Valhalla routing engine's motorcycle profile. Unticked: OSRM, which drives unsealed roads more slowly but will still use them when they are much shorter. Press Plan trip after changing it.

Press Plan trip after changing the start, vias, finish or Sealed roads only. Every other setting updates the sheet as soon as you change it. While planning, the green header shows "Planning…" and the line under the button shows each step.

Clear trip (next to Plan trip) starts a new route. Click it twice to confirm; the second click must come within 4 seconds. It removes the current trip, including the sheet, map, edits and weather, and empties Start, Via and Finish. It keeps your riding settings and the remembered place results and fuel hours. If you close and reopen the page afterwards, you get the empty form with your settings, not the example trip. If you might want the trip again, use Save plan first.


The trip sheet

Each row is a stop. The numbers on a row describe the leg that arrives at that stop, the same layout as the original spreadsheet.

Column Meaning
# Stop number (matches the pins on the map).
Flags FUEL and FOOD buttons. An amber Fuel 303 means a fill is planned here, 303 km after the previous fill. + fuel / + food means it's available but not planned; no fuel / no food means none was found in the map data. Click FUEL once to override the planner, and again to hand it back; a dot after the label means you set it by hand. Clicking no fuel first asks No fuel found in …: do you REALLY want to stop here for fuel? Cancel leaves it alone; Yes, fuel is here (override) plans the fill anyway (for a servo the map doesn't know about), shown in violet as Fuel? 303 with No fuel in map data · your override under the stop name. Click it again to remove it. On the start row FUEL just means you leave on a full tank, so it doesn't ask. Ticking FOOD makes it a meal stop (meal-length).
Stop The town. A servo or roadhouse that isn't inside a town shows its name and where it is, e.g. Ampol, Horsham (from its address) or 7-Eleven, near Dimboola (the nearest named place, when it has no address in the map data). Stops the planner chose have a drop-down of nearby alternatives, showing how far away each one is and what it has. The grey line underneath lists the services found and how far the town is off the route. Fuel stations show their opening hours when OpenStreetMap has them, e.g. Fuel (Ampol 24 hrs, BP Mo-Su 06:00-21:00), otherwise just the brand. If every fuel station there has recorded hours and all of them are shut when you arrive, Fuel closed on arrival shows in red; if it's a planned fill, a warning also appears above the table. Many country servos have no hours recorded, so no warning doesn't guarantee they're open.
State State, plus the time zone in use (e.g. ACDT).
Km / Total Length of this leg, and the running total.
Km/h Average speed for the leg. Hover to see the average at 100% of the limits. Type a number to override it; auto goes back.
Ride Riding time for the leg (h:mm).
Arrive / Depart Local times. Type a departure time to set when you leave a stop, e.g. after a night there; auto goes back to the stop minutes. On an overnight, the departure is on its leave line. Changing the departure on row 0 changes the trip's departure time.
Stop min Length of the stop. Type a number to override the rest / fuel / meal length. Typing minutes on a stop with a set departure time replaces that time.
Since fuel Km ridden since the last planned fill. Shown in red if it's over your fuel range, with a warning above the table.
Weather on arrival Temperature, conditions, chance of rain, wind and gusts for the hour you arrive (for the start, the hour you leave). Forecasts only go 16 days ahead.
Sun Sunrise and sunset at that stop on the day you arrive. Overnights show that evening's sunset, with the next morning's sunrise on the leave line.
Light After dark if any part of the leg arriving at this stop is ridden before sunrise or after sunset. Dusk/dawn if it starts or ends within 30 minutes of either. On the start row, and on the leave line of an overnight stop, it shows Leave in dark or Leave at dawn/dusk instead, for the moment you set off.
+ stop / remove Add a stop after this row (the planner searches the gap and adds the best place, preferring fuel), or remove a stop the planner chose. On an overnight, + stop is on the leave line. Start, vias and finish can't be removed here; change them in the Trip panel.
Notes Your own notes, in the last column. They are kept with the plan and exported.

Overnight stops

A stop of 5 hours or more, usually a via with a departure time such as Mildura VIC @ 06:00, is an overnight. It takes two shaded lines, so the night stands out:

A green line under the pair marks the end of the riding day.

Warnings appear in red above the table: a stretch longer than your fuel range, and a planned fill where the recorded hours say the servo will be shut when you arrive.

Below the table, one day card per riding day shows the distance, riding time, stop time, leave and arrive times (with time zone), total time on the road, and any dark or dusk legs. The green header shows the totals for the whole trip: distance, riding time, days and fuel stops.

On the map

Buttons


How it works

Route

With Sealed roads only ticked, the route comes from the public Valhalla server (the routing engine on the OpenStreetMap website), using its motorcycle profile set to avoid unsealed roads and tracks. An unsealed road is only used right at the start or finish, for example a gravel driveway.

This relies on roads being marked as sealed or unsealed in OpenStreetMap. Most main roads are. Some remote roads have no surface recorded, and Valhalla then judges by the type of road, so an occasional unsealed road may still slip through. Check remote sections on the Satellite map.

The public Valhalla server won't take a single request covering more than 1,500 km, so the planner asks for the route one leg at a time (start to first via, via to via, and so on). A leg longer than about 1,400 km in a straight line is split into pieces of about 1,000 km along the highway, then joined back into one leg, so the split points never show as stops.

If Valhalla can't be reached or can't find a sealed route, the planner uses OSRM instead and says so in red. OSRM's public server has no option to avoid unsealed roads; it only drives them more slowly.

With the box unticked, OSRM is always used.

Choosing stops

The planner picks stops one at a time, searching as it goes:

  1. Jump the stop spacing (e.g. 100 km) along the route from the last stop.
  2. Search 25 km either side of that point for towns and roadhouses with fuel, food or a store.
  3. If there's nothing, widen the search step by step. This handles long empty stretches in the outback.
  4. Score each place and pick the best. Places closer to the target distance score better. Bigger towns, places with food, and places with fuel when the tank is getting low get a bonus. Places that would leave you short of fuel are avoided. Before an overnight that has no fuel, the last stop is pulled towards a place with fuel as close to the overnight as possible.
  5. Repeat from the chosen stop until the next via or the finish is within about 1.3 × the spacing.

Localities that exist in name only (no fuel, food or shop in OpenStreetMap) are never chosen.

Fuel stops

Fuel stops are planned by these rules, in order of priority:

  1. Never ride further than your fuel range between fills, where the map has fuel that makes this possible.
  2. Fill at the end of each day, at the overnight stop or the closest stop with fuel before it, so you start the next morning full.
  3. Use as few fills as possible.
  4. Spread the fills as evenly as possible across the day. For example, a 1,000 km day on a 300 km range gives 4 fills at about 200 / 400 / 700 / 1,000 km rather than 300 / 600 / 900 / 999.

Anything you tick or untick by hand is kept, and the rest is planned around it.

A stop counts as an overnight if it has a set departure time or a stop of 5 hours or more.

Speeds and times

Each leg is timed at Speed (% of limit) of the speed limits along it.

After routing, the route's line is sent back to Valhalla's trace_attributes service. This works for both Valhalla and OSRM routes. For each stretch of road the route uses, it returns the type of road, the recorded speed limit (if OpenStreetMap has one) and Valhalla's own speed. Each stretch is then timed at:

The route is sent in pieces of up to 150 km. A piece never runs past a via, so it never contains a turn-around. Extra points are added every 0.5 km along long straight sections, because the matching gives up when points are more than 2 km apart. No leg is timed faster than 130 km/h at 100%.

After a plan, the status line says what share of the route had a recorded limit, e.g. "recorded for 33% of the route".

If a piece can't be read, it keeps the route's own timing: Valhalla's road speeds on a sealed-roads route, or limits estimated from OSRM's speeds otherwise. The status line then says how many km that was. If none can be read, the whole route keeps its own timing, and the status line says why.

If a leg still looks wrong, type a speed into its Km/h cell.

Times are calculated in each stop's own time zone, from Open-Meteo, so crossing into SA or QLD and daylight saving changes are handled. Until the weather service answers, a rough built-in guess is used.

Sunrise and sunset

These are calculated on your computer using the standard (NOAA) sunrise equation, accurate to about a minute. No internet is needed for this.

Weather

Forecasts come from Open-Meteo: the hourly forecast nearest each arrival time (and each overnight departure), up to 16 days ahead. They follow your edits, so changing a time or speed picks up the forecast for the new hour straight away. They are refreshed when older than 3 hours, when stops change, or when you press Refresh weather.


Data sources

Service Used for
Valhalla (FOSSGIS public server) Route with Sealed roads only ticked; speed limits and road types along every route
OSRM demo server Route otherwise, or if Valhalla routing fails
Photon Finding your start, vias and finish; main search for towns, fuel and food
Nominatim Fuel station opening hours (looked up by map id after the stops are chosen); backup for finding places
Overpass Backup for fuel station opening hours, and backup search for towns, fuel and food
Open-Meteo Forecasts and time zones
Esri Map pictures

The page also loads its map library (Leaflet) and fonts (Google Fonts) from the internet when it opens.

All place and road data is from OpenStreetMap and its contributors. These are free, shared services, so the planner spaces out its requests. If one is busy, it waits and retries, and the status line counts down. If both place searches fail, the stops found so far are kept, and pressing Plan trip again a few minutes later carries on from where it stopped.


What is saved on your computer

Three things are kept in the browser's storage on this computer only:

Clear trip removes only your last plan. The place results and fuel hours stay, so a new route over country you've already searched is still quick.

Chrome and Edge treat every page opened from a file as the same site for storage. So a new version of index.html picks up the plan left by the previous version, wherever you saved it. Press Plan trip to re-plan it with the new version's rules.

Use Save plan to keep a trip permanently or move it to another computer.


Troubleshooting

Message or problem Cause and fix
"…inside another app…" The file is open in an app's preview. Save it and open it directly in Chrome or Edge.
"…could not be reached…" No internet, or an ad blocker or firewall is blocking that service.
"Place search is busy, trying again in N s…" Photon is busy. It retries on its own.
"Place search failed…" Photon and the Overpass backup both failed. Stops found so far are kept; press Plan trip again in a few minutes.
"Could not find …" Add the state, e.g. Keith SA, or type latitude and longitude.
"No route found" The routing service couldn't route between those places. Check the green "matched to" text under each box.
"A sealed-roads-only route could not be made…" Valhalla couldn't be reached or found no sealed route, so OSRM was used and the route may include unsealed roads. Try Plan trip again later, or check remote sections on the Satellite map.
"Speed limits could not be read…" Valhalla's speed-limit lookup failed, so the route's own timing is used (see Speeds and times). Plan trip again later for the full method.
"Speed limits could not be read for N km of the route…" Part of the route couldn't be matched; those km keep the route's own timing.
"Fuel station opening hours could not be loaded…" Both hours services failed. The trip is otherwise fine; press Refresh weather to try again.
"Opening hours recorded for 0 of N fuel stations…" The lookup worked, but those servos have no hours in OpenStreetMap.
"Beyond forecast range" The arrival is more than 16 days away.
A leg speed looks wrong Type the right speed into its Km/h cell. If they're all a bit high or low, adjust Speed (% of limit). Legs through towns are slower because built-up streets keep Valhalla's lower speeds.
Map shows "Access blocked" or "API key required" A map provider refused. The page uses Esri maps; try the Topographic or Satellite switch.
"Map library did not load." The map library couldn't be downloaded (no internet, or blocked). Planning still works without the map; reload once you're online.
"Wait for the current planning to finish, then clear." Clear trip was pressed while planning; try again once it's done.
Buttons at the right of the sheet are off screen Scroll the sheet sideways; on a narrow window the table is wider than the screen.

For anyone editing the code

index.html has three parts, all commented in detail:

  1. Page layout and styles (HTML and CSS). Colours are named settings at the top of the styles, with light and dark versions.
  2. Core: all calculations, with no screen and no internet. This covers the route model, re-timing at the speed limits, possible stops, stop scoring, fuel planning, reading opening hours, time zones, sunrise and sunset, and the sheet and day totals. It can be tested on its own in Node.js.
  3. The page script: the Trip form, online lookups (routing, speed limits, place search, opening hours, weather), stop picking, map, sheet drawing, editing, Clear trip, export and saving.

All the code is in index.html. It was developed as separate files (template.html, core.js, app.js) and combined into it.

Two functions in Core, chooseStops and samplePoints, are no longer used by the page; they are kept because the tests use them.