Skip to content

In the Zone

The engineering under a famous system: the geospatial model that decides whether a vehicle is inside London’s congestion-charge zone, and the test engineering that keeps that decision honest on a platform handling the public’s money.

Everyone in London knows the Congestion Charge. Far fewer think of it as a geospatial problem, but underneath that is what it is: for a given vehicle, a deceptively simple question: is it inside the charging zone? This was a contract backend role on that system, one of the most complex urban-transport platforms anywhere. Two threads ran through it, both about getting the answer right: the geospatial engineering that decides in or out, and the test engineering that made a system handling the public’s money safe to change.

C#GeospatialMySQL

Is it in the zone?

“Inside the zone” sounds like a line on a map. In the system it is a data model. The charging area is a set of boundaries with rules attached (exemptions, and edges that change over time), held and queried in MySQL, and deciding whether a location falls inside it is a point-in-polygon test run over and over at the scale of a city’s traffic. The work on this side was the geospatial API and the model behind it: representing the zone so the boundary questions could be answered correctly and quickly, and keeping that model right as the real-world zone changed.

The charging zone as a point-in-polygon problemA map view of the charging zone drawn as an irregular polygon. Vehicle locations inside the polygon are marked as charged; locations outside it are not. Alongside, a note explains that the zone is really a data model, its boundaries and rules held in MySQL, and that the geospatial API answers the in-or-out question as a point-in-polygon test at city scale.Charging zonein the zone: chargedoutside: not chargedunderneathUnderneath: a data modelzone boundaries + rules,held in MySQLgeospatial API answers:in, or out?a point-in-polygon test,at city scale
The Congestion Charge is a point-in-polygon problem: for each vehicle location, is it inside the charging zone (charged) or outside it (not)? The zone is a data model, boundaries and rules held in MySQL, and the geospatial API answers in or out.

A wrong answer is a wrong charge

On most systems a bug is an inconvenience. Here a wrong answer is a wrong charge: someone billed who should not be, or missed who should. That raises the cost of every change, and the way to lower it is confidence. Taking ownership of the test engineering meant building the layers that give it: unit tests on the charging logic, integration tests across the components, and contract tests at the seams where this system meets the others it depends on, with the harnesses to run them all. Confidence was not a phase at the end; it was what let the system keep changing safely.

Layers of test confidence, with contract tests at the seamsThe Congestion Charge system holds unit tests on its charging logic and integration tests across its components. At the boundary where it meets the other systems it depends on, contract tests guard the seam. All run on harnesses. The framing is that a wrong answer is a wrong charge, so this confidence is what lets a live public system keep changing safely.A wrong answer is a wrong charge, so confidence is the product.Congestion Charge systemUnit teststhe charging logicIntegration testsacross componentsContract testsat the seamsIntegrated systemseach one a boundaryAll of it on harnesses built to run it: the confidence to keep a live public system changing safely.
A wrong answer is a wrong charge, so confidence is the product: unit tests on the charging logic, integration tests across components, and contract tests at the seams where the system meets the others it depends on, all on harnesses built to run them.

Left better than found

A contract can be a stint of feature work and nothing else. This one left marks that outlasted it: engineering processes tightened, documentation filled in where it had been thin, and the codebase and the team’s practices in better shape at the end than the start. The tests were the largest part of that, a safety net that stayed after the contract did.

The engineering under a famous system

The Congestion Charge is a landmark piece of public infrastructure, and the interesting part of it is the least visible. Not the cameras or the payment screens, but the geospatial model that decides who is in the zone, and the tests that keep that decision honest while the system evolves. Famous on the surface, unglamorous correctness underneath. That underneath is the engineering.

Geospatial engineering recurs across very different systems: the patented area-finder at ShefDigs, and the data-accuracy work on a NATO coalition platform.