What Counts as a U-turn?

Technical

A yellow diamond road sign showing a hairpin u-turn arrow, on a bend of a tree-lined road

Actually, this is a sharp right turn, not a u-turn!

You run a route through Match to Roads, open the turn list, and step three says U-turn onto Bareldonkstraatje.

It is not a u-turn. It is a sharp left at a fork, the sort of corner you take without really slowing down, and we have just told the rider to stop and turn round.

That report came from a reader who has been through more of our GPX output than anyone else, and who knows the Locus Map and Cruiser navigation extensions from the user's side far better than we do. They were right, and the rule turned out to be more interesting than I expected.

Three symbols, not one

The navigation extensions those apps read do not have a single u-turn. They have three.

u-turn - turn round, your choice which way
u-turn_left - round to the left, and only left
u-turn_right - round to the right
left_sharp - not a u-turn at all

I had been treating the first as the vague version of the other two: it says turn round, and if we know which way the road bends we may as well say so. That is backwards.

Cruiser shows a u-turn as an inverted U without arrows. Locus shows a u-turn as an inverted U with 2 arrows. This means the user practically FREELY determines whether to turn left or right and come back. With a left or right u-turn you MUST turn as the icon indicates.

The plain symbol is a permission. It appears where you go back down the road you arrived on, and it does not care which way you swing round, because either way works. The directed symbols are instructions: there is a correct way round, and the other way puts you somewhere else. Turning every plain u-turn into a directed one, which is what I did first, does not add information. It takes away a choice the rider had.

The angle cannot tell them apart

We read corners off the shape of the line: the heading 20 m before a point against the heading 20 m after it. Past 150 degrees is u-turn territory.

That gets you into the neighbourhood and no further.

where angle what it should be
Kurviger route, point 216 151 degrees sharp left
Kurviger route, point 22 156 degrees u-turn left

Five degrees apart, opposite answers. No threshold fixes that, because the angle is not measuring the thing that makes a u-turn a u-turn.

What actually decides it

A u-turn is about where you end up, not how far round you went.

A reversal on the same lineinoutthe same lineu-turn
Back down the same line. Nothing to choose between: turn round whichever way the traffic allows.
A reversal onto the road alongsideinout14 m apartu-turn left
Back along the road beside it. A dual carriageway, a service road, the far side of a central reservation. Now it matters which way you go round.
A sharp turn onto a different roadinout37 m apartsharp left
Off down a different road. It doubles back, but it is not the road you came in on. Calling this a u-turn is what started the whole thing.

So we measure the gap between the way in and the way out. Under 5 m the two are the same road, which is the plain symbol and the permission that goes with it. Under 25 m, near enough a carriageway plus a verge, so it is worth one instruction instead of two consecutive lefts, but you have to go round the correct way and the symbol has to say which. Beyond that it is a different road, and a sharp turn.

The PitStopper turn list showing two rows reading U-turn left onto Sportlaan, both flagged red, beside a map where the route runs out along one carriageway and back along the one beside it

That is the middle case on a real map. The route goes out along Sportlaan and comes back on the road immediately alongside, so both turns are u-turn_left: not a choice, an instruction.

Except the gap does not work alone either:

where angle separation what it should be
Kurviger route, point 216 151 degrees 35.4 m sharp left
Cruiser's own file, point 3 175 degrees 34.3 m u-turn left

One metre apart. The first is a fork onto another road; the second is a genuine turn round that uses a wide bit of tarmac to do it, and Cruiser itself labels it u-turn_left, so there is no arguing with it.

Plot every near-reversal in the three test files against both measurements at once and you can see the shape of the answer:

Every near-reversal in the three files, plotted by angle and by separation010203040130°140°150°160°170°180°how far apart they run, metreshow far round the turn goesu-turnu-turn left / rightsharp left / right151°, 35.4 m: sharp left175°, 34.3 m: u-turn left
Every near-reversal in the three test files. No vertical line through this chart separates the colours, and no horizontal one does either. The two labelled points sit a metre apart and get opposite answers; the amber point at 156° and the purple one at 151° are five degrees apart and also get opposite answers. Only the corner shape works.

No vertical cut separates the colours and no horizontal one does either. What works is the corner: past 150 degrees and coming back close, or past 170 degrees regardless of how wide the turn had to be. Beyond 170 you are so nearly reversed that a wide sweep is just a wide sweep; below it, the width is telling you that you have gone somewhere else. Four numbers, all sitting together at the top of the file so they can be argued with:

uTurnDeg: 150,     // in u-turn territory at all
sameLineM: 5,      // the same road: plain u-turn
parallelM: 25,     // a carriageway and a verge: directed u-turn
reversalDeg: 170,  // so nearly reversed that width stops mattering

Measuring the gap

The separation is the median distance from the exit points to the approach linethe turnthe approach,taken as a line60 m of the way out,measured and sorted:15.0 m16.0 m16.0 m16.0 m17.0 mmedian: 16 mnot the smallest: the two legsalways touch at the turn, so thesmallest is always about zero
How the gap is measured. Each point on the way out is dropped perpendicularly onto the approach line, not onto the nearest recorded point of it, so a sparsely recorded track and a dense one give the same answer.

Two traps in there. The first is the median: it is tempting to take the smallest distance between the two legs, but they meet at the turn itself, so the smallest is always about zero. The second is that the exit points are measured against the approach line, not the nearest recorded point on it. Point to point, the answer depends on how densely the file happened to be logged, and a track recorded every second would score differently from the same road recorded every 50 m. That is not a difference anybody riding it would recognise.

The smallest test file caught a related bug. A single 180 degree turn, one road, 13 points across 673 m, which is about 90 m between vertices. The probe walked 60 m either side looking for exit points, found one, and stopped. One point defines no line, so the turn fell through unjudged. Collect two points first, then check the distance.

Why it is red

U-turns are flagged red in our turn list, because an unexpected one nearly always means a shaping point landed on the wrong side of a road and the router has dutifully sent you past it and back.

The PitStopper turn list in dark mode. Step three reads U-turn onto Bareldonkstraatje, highlighted in red with a plain inverted-U icon, and the same turn is marked on the map beside it

Here the route doubles back on itself, so the symbol is the plain one and its icon carries no arrow. Turn round whichever way you like.

That flag was keyed on the literal string u-turn, so the moment we started emitting u-turn_left it would have quietly stopped appearing on the turns most worth flagging. It now runs through one shared test that knows all four spellings.

The icon

Bootstrap Icons, which we use everywhere else, has no u-turn. It has no acute sharp turn either, and nothing that says bear left at a fork without also saying or bear right. Turn instructions have moved to a proper manoeuvre set, and we drew the side-neutral u-turn ourselves: an arch with an arrowhead at each end, which is as close as a static glyph gets to saying "either way". The whole vocabulary is on turn-icons.html, in both themes.

Where it landed

All three test files now convert to exactly what their sources say. The Kurviger route yields no plain u-turns at all, because it contains no true reversals. Cruiser's own file keeps both of its directed ones. The 180 degree demo stays plain, with the choice it was always offering.

That last part is the bit I would not have reached on my own. A plain u-turn is not a directed u-turn with the direction missing. It is a different instruction, and the rider is the one who decides.

Header photo by Jim Wilson on Unsplash.