Skip to main content

Ride any track either way — legally, with turns

· 3 min read
Massimo Di Stefano
FastGIS author

Follow a GPX in the direction it was recorded and the turn-by-turn is good. Follow it the other way and, until today, the line sent you round every roundabout on the empty side of the road. A recorded track is a path, not a route: reversed, it runs against one-way streets, divided carriageways and roundabouts. As of today every imported GPX, TET sub-trail and Library line rides in either direction on a legal route with full turn-by-turn.

Why it went wrong​

The map-matcher we use does not fail on a track that cannot be ridden as drawn. It answers with the first legal piece and hides the rest in a field the app never read, so a 22 km reversed ride collapsed to its first 60 m, failed a sanity check, and was ridden as the reversed drawing — clockwise round 12 of its 13 roundabouts.

What happens now​

A track keeps one built trip per direction. The builder starts from the original points, never from a matched shape: it map-matches them into continuous legal pieces, bridges every gap with a legal route whose ends are trimmed back and forward along the pieces (a bridge that starts inside the illegal spot loops back through the same junction), picks the bridge closest to your drawing rather than the shortest, and then checks the assembled line with a second legal map-match. Where there is no road at all — a hiking trail, a field — the stretch stays follow-the-line and says so.

On the owner's roundabout-rich track the reversed ride went from twelve wrong-way roundabouts to none, with no U-turns and every metre covered by turn-by-turn. A left-hand-traffic town and a divided carriageway behaved the same; two-way country roads need no bridges at all and ride exactly as before.

In the app​

  • Both directions are built when you enhance a track, so opening it reversed works offline and starts at once. Joining mid-track slices the built trip at your position instead of re-matching it.
  • Set off against the loaded direction and the app notices within a few seconds, switches to the other direction's trip where you are, and tells you. No reroute storm.
  • Chevrons on the track line show the ridden direction, and wherever the legal line leaves your drawing — the other side of a roundabout, a bridge across a stretch you cannot ride that way — the drawing stays visible as a faint dashed ghost, on the phone and on the car screen.
  • Library lines recorded on a ride or drawn on the desktop now rejoin the track after a detour instead of being replanned to their end.
  • Trail source codes no longer leak into spoken instructions.

The builder is also an API for your own tools: POST /grass/routing/track-direction takes a track and answers with the legal trip for either direction, the bridges it added and their extra length, and the validation result.