kerbtracer — how the trace works
← Back to the viewer

How the kerb trace works

You click once on a kerb. The tool walks along it in both directions, measuring a fresh cross-section every 25 cm, and hands back a 3D line. This page is about what happens in between — and, just as importantly, about where it stops and admits it does not know.

The shape of it

Six stages run for every click. The first four happen live, walking forward into ground the tool has not seen yet. The last two run afterwards, over the finished line, when the geometry on both sides of every point is known.

The pipeline. Stages 1–4 are a live march: every decision uses only what is behind it. Stages 5 and 6 look at the whole line at once, which is why they can correct things the march could not have known about.

One idea underpins all of it. The tool never snaps to a point in the cloud. Points in these clouds sit 2–3 cm apart, and a survey wants better than that. So every position it reports is fitted from surfaces — a few hundred points of road and a few hundred of footway — and the kerb edge is found where those two surfaces are related in a particular way. Fitting many points beats snapping to the nearest one, and that is where the accuracy comes from.

Step 1 The click, and which way the kerb runs

Your click gives an approximate position and nothing else. The tool has to work out the direction the kerb runs before it can measure anything, because every measurement it makes is taken across a slab laid at right angles to that direction.

So it tries sixteen directions through the click, spread over a half turn, and measures a cross-section along each. On a straight kerb this is easy: a slab laid at an angle smears the kerb face across the section and fails to find a step at all, so only directions close to the true one produce a fit. At a corner it is not easy. The kerb is already curving inside the slab, so eight to thirteen of the sixteen directions produce a plausible fit, and simply keeping the best-scoring one is a coin toss. Clicks 10 cm apart used to come back with headings 113° apart, and some of them ran off across the road.

The fix is not a better score, it is a corroboration test: a direction is only believed if the kerb continues along it. The tool steps one 25 cm pace forward and one back along each candidate direction, and re-measures. If the direction is wrong by an angle, the kerb appears displaced to one side ahead and to the other side behind — and by how much tells you exactly how wrong the direction was.

Why the two probes are worth more than the score. A heading error puts the kerb off to opposite sides ahead and behind, so the difference between the two offsets measures the error directly. Curvature puts it off to the same side both ways, so it cancels in that difference. That is why this works at the corner, where scoring does not: the test is blind to the one thing that makes a corner hard.

Two more things the probes check, and both exist because of real failures: the kerb ahead and behind must be about the same height as the kerb at the click, and the footway must be on the same hand. That second one is what rejects the kerb on the far side of the street — it is exactly the same height, so height alone cannot tell them apart, but the carriageway lies between them, so crossing it puts the high side on the other hand.

Step 2 Reading one cross-section

This is the measurement everything else is built from, and it is repeated a few hundred times per trace. The tool cuts a slab across the kerb — 0.8 m along the kerb, 2 m across it — and collapses every point in it into a profile: the ground level in each 1 cm-wide strip across the slab.

The slab, seen from above. Points inside it are sorted by how far across the kerb they sit, ignoring how far along. A slab 0.8 m long averages out random noise; making it longer would start to smear real curvature.

Each 1 cm strip reports a low percentile of the heights in it, not the average. That is deliberate: the average is dragged upward by points resting on the kerb face and by litter, and the minimum picks up stray points below the surface, which photogrammetric clouds have plenty of.

Then it finds the step. Not by intersecting the road and the footway — they are nearly parallel, so where they cross depends on almost nothing and lands metres away. Not by fitting a line down the kerb face either — the face is only 2–3 cm wide in plan, which is two or three strips. What it does instead is fit a line to the road, fit a line to the footway, and find where the profile between them crosses a set fraction of the way up the step.

The cross-section. Drag the sliders. The road and footway lines are each fitted over dozens of strips, which is what beats the 2.5 cm point spacing; the crossing between them is then located to well under one strip.

The crossing level is set at 65% of the step height, and there is no geometric reason for that number — it is where the surveyors who drew this project's ground truth put their lines, partway down the rounded shoulder of the kerb. It is the single setting accuracy is most sensitive to, and the first thing to re-tune on a new site.

Push the batter slider and you can see the problem with the whole idea. On a kerb leaned back or worn down, the 65% crossing slides inward, so the line records how weathered the kerb is rather than where the arris is. That is precisely the imperfection you wanted a line to see past.

The section template

So there is a second, better reading of the same profile: fit three straight parts — road, face, footway — and construct the two corners they define. The arris is where the face meets the footway; the toe is where it meets the road. This is a well-conditioned intersection precisely where road-meets-footway was not, because the face is near-vertical and the footway near-horizontal, so they meet at close to a right angle.

Measured against a known synthetic kerb, the 65% crossing drifts across 4.8 cm as the batter goes from plumb to heavily raked, while the constructed arris stays within a few millimetres and stops moving with the batter at all. It also still works on faces so raked that the crossing method gives up entirely — try the last third of the batter slider above. The template needs no points near the corner — it works out where the corner would be — which is exactly why it survives weathering.

Step 3 Walking the kerb

With a position and a direction, the march is simple to state: step 25 cm forward along the current heading, cut a new slab, fit it, append the vertex, update the heading, repeat. Then do the whole thing again backwards from the click. It stops when it runs out of kerb, when the line would have to turn implausibly sharply, or after 1200 steps.

The heading comes from the last eight vertices — about 2 m of kerb — because a heading taken from just the last two carries all of the newest vertex's noise. One 3 cm sideways wobble over a 25 cm step is 7°, and the trace then coasts off at that angle. Fitting a direction to 2 m of line was the difference between stopping at 60 m and tracing a full 85 m kerb.

But there is a subtlety that costs centimetres on every bend, and it is worth understanding because it explains where the residual error in this kind of tool lives. A straight line fitted to the last 2 m gives you the direction of the kerb in the middle of that 2 m — a metre behind where the march is actually standing. On a bend the kerb has turned since then, so the tool sets off about 11° wide at a 5 m radius, the slab lands oblique, the kerb face smears, and the vertex lands inside the true line.

The heading lag on a bend. Drag the radius. The grey heading is the direction of the trailing window's middle; the yellow one is a curve fitted to the same window and read at its tip, which is where the march actually is. Same data, right point.

The fix is not a different measurement, it is the same measurement read at the right place: a gentle curve is fitted to that same trailing window and its direction taken at the newest vertex. On synthetic kerbs of known radius this cuts the inward lean from 6.2 to 1.7 cm at a 5 m radius, and from 10.3 to 3.2 cm at 3 m.

Step 4 Gaps

About a third of the kerb in this project's sample streets is not measurable: driveways, dropped crossings, parked cars, occlusion shadows. Gaps are the normal case, not the exception, so the march has to be able to cross one — and that is the most dangerous thing it does, because a gap is exactly where there is no evidence.

Gaps also sit disproportionately on corners — dropped kerbs are at junctions and crossings — so simply continuing straight cuts the corner. But forcing the recent curve through the gap is worse: a small turn rate integrated over 12 m walks clean off the kerb. What works is a race. The tool launches several continuations — straight, hold the current curve, ease it off — and keeps whichever finds kerb again first.

Crossing a gap. Several continuations run at once and the first to re-find kerb wins; ties go to the one that turned least. A candidate that finds the kerb on the far side of the road is rejected — not by its height, which matches perfectly, but by which side the footway is on.

A re-acquisition is only accepted if it is continuous with the kerb that was lost: about the same height, and the footway on the same hand. The height tolerance cannot be tight, because across a dropped kerb the kerb genuinely resumes at a different height. And the tool will not steer on a curve it does not have evidence for — if the trace leading into the gap was itself mostly guesswork, only the straight continuation is offered.

If nothing re-finds the kerb within 18 m, the trace ends at its last confident vertex and emits nothing at all for the gap. It does not trail off into open ground. A short line is a much better deliverable than a long one that is wrong somewhere in the middle without saying where.

Step 5 Going back over it

Everything up to here is causal: each decision used only what was behind it. Once the march has finished, the tool knows what is on both sides of every vertex, and that is genuinely new information — not a cosmetic pass. Five things happen, in order.

Re-measuring, with the bend known

Every vertex is re-fitted with a heading taken from a window centred on it rather than trailing behind it, with the curvature measured from both sides, and with the strips laid along the curve rather than a chord. This is where the heading lag described above is finally removed rather than merely reduced.

Filling in the gaps from both ends

During the march, a gap could only be crossed by extrapolating from the near lip. Afterwards both lips are known, so a bridge is replaced by a smooth curve fitted between the two, and then re-measured along its length. Where the kerb is really there after all, those vertices are promoted from guessed to measured: on one of the sample kerbs this took coverage from 76% to 94%.

Recovering kerb the march refused

The march insists on a step at least 6 cm high completing within 12 cm across. That is right while marching — a 2 cm rise with only a trailing heading locks onto pavement noise — but wrong afterwards, when the position, direction and curvature are known from both sides of the gap. So inside bridged runs, and working inwards from each confident lip so every accepted vertex is continuous with a measurement, the tool re-measures with relaxed rules.

Taking the wobble out — without cutting corners

Each cross-section is fitted independently, so each vertex carries 1–3 cm of its own sideways noise at 25 cm spacing. A kerb is a manufactured product laid to straights and circular arcs; it physically cannot wobble at a 25 cm wavelength. So that wobble is known to be measurement noise, and removing it is a measurement, not a tidy-up.

The tool will not use an ordinary smoother, because an ordinary smoother cuts real corners, and real corners are the whole point. Instead a vertex is nudged toward the arc through its neighbours only when its error is uncorroborated — when it sits off to one side and both of its neighbours sit off to the other.

The corroboration rule. Left: noise flips side vertex to vertex, so every vertex disagrees with both its neighbours and gets pulled in. Right: at a genuine change of curvature the errors arrive in runs — each vertex agrees with a neighbour, so the rule suppresses the move and the corner survives. A constant-radius arc is left exactly where it is. Each panel is magnified to its own largest error, and they are not the same size: a real corner's signature is far smaller than the noise, which is why the test has to be which way the errors point and not how big they are.

Setting the line down on the ground

A bridged vertex has its height interpolated straight across the gap. But the commonest reason for a gap in the first place is a vehicle crossing — full height, ramp down, ramp back up — and a straight line across a V is a line through the air. That error is systematic, and it is worst exactly where gaps are likeliest.

Why the reference is the ceiling, not the ground. Clamping to the lowest ground nearby drops the line onto the carriageway — measured, that is 15 cm too low. The kerb top rests on the footway at the edge, and nothing sits above it, so the tool takes a high percentile of the points around each bridged vertex and lowers the line onto that.

Three rules keep this safe. It may only ever move a vertex down — "there are no points above you" has one explanation, while "there are points above you" has many innocent ones, starting with a parked car. It never touches a measured vertex, because correcting a measurement against a cruder estimate of the same thing is inventing geometry. And the estimate is calibrated per trace against that trace's own measured vertices, so it needs no per-site constant. Across the sample data this took the count of bridged vertices floating more than 5 cm above the ground from 207 to 0.

Checking the grades

Finally, the tool checks that the line behaves like a kerb vertically. A kerb top follows the road's longitudinal grade — under 8% almost always — so a vertex that implies a steep slope or a sudden break to its neighbours is either repaired, if a robust line through its neighbours agrees, or demoted: its position is left exactly where it is, but it stops claiming to be a measurement and exports as bridged instead. Demotion is the honest outcome, and the tool's own regression tests treat it as a pass, not a failure.

Step 6 The design line

An 80 m kerb comes out of step 5 as roughly 320 independently measured vertices, each carrying its own millimetres of noise. That is the right answer to "where is this kerb". It is the wrong answer to "what was this kerb laid to" — and for setting-out, checking as-builts or handing geometry to a designer, the second question is usually the one being asked.

So a last stage fits an alignment to the finished line: straights and circular arcs in plan, grades with vertical curves in elevation, and one batter and upstand shared along each run. Eighty metres of kerb becomes about twenty numbers. The wobble has nowhere left to live.

Measured, then idealised. The alignment is fitted as straights and arcs with the joins as free parameters — it is not a smoothed version of the measured line. Traced twice with different noise, the measured lines differ by about 2 mm and the design lines by about 0.2 mm, which is the operational test that it has recovered the design rather than the imperfections.

Two things keep it honest. Only measured vertices vote — the alignment may span a gap, but nothing the march guessed is allowed to shape it. And it refuses: too few confident vertices, too poor a fit, or a gap longer than 6 m, and it emits nothing for that run and says why. Where a kerb really is settled, damaged or hand-laid, the alignment does not straighten it out silently — those stations are flagged on their own layer.

The measured line is never discarded. The design is an additional line, drawn over it, on its own layers, behind its own checkbox.

Reading the output

The colours on screen and the layers in the exported DXF carry the same distinction, and it is the one that matters: which metres were measured and which were guessed.

On screenMeansDXF layer
Yellow Measured. A cross-section was fitted here. KERB
Orange Bridged. Interpolated across a gap, or demoted by the grade check. KERB_BRIDGED
Pale blue Measured against a genuinely low upstand — a dropped kerb. KERB_LOWERED
Green The refined line, drawn over the raw march.
Magenta The design arris. KERB_TOP_DESIGN
Amber The design toe, derived from the arris through the section. KERB_TOE_DESIGN
Stations where the measured kerb departs systematically from the design. KERB_DESIGN_FLAGGED
Cyan Ground truth overlay, where a labelled dataset is loaded.

The fitted and bridged layers share their transition vertex, so they meet rather than leaving a hole at every gap edge. Coordinates are written unshifted in the cloud's own system, with the EPSG code in a comment, because the DXF format has nowhere else to record it.

What it will not do

Every threshold in the tool is site-dependent, which is why they are all exposed in the parameters panel rather than buried. Setting any post-processing threshold to 0 turns its stage off, so you can see exactly what each one contributed.

kerbtracer is a proof of concept. The numbers quoted on this page come from its own regression harness, which traces the labelled sample clouds from fixed seeds and fails the build on any regression.