Case study

SafeMaps

Most map apps pick the fastest route. SafeMaps asks a different question first: which route is safest? Then which uses the least fuel, and only then which is quickest.

The problem

A fast route often turns left across oncoming traffic at a busy or crash-prone junction, or drives through lane closures. A route chosen for speed alone doesn’t count that. SafeMaps does, and explains its choice in plain words.

How it works

  1. It downloads OpenStreetMap roads for the Milwaukee area and turns them into a road graph that knows which turns are allowed.
  2. Its own routing engine, an A* search that gives every turn a cost, designs the candidate routes. The search runs in a small Rust library that the Python backend calls.
  3. Every route is scored for risky turns, crash-prone junctions (from NHTSA crash data), work zones and closures (WZDx and Wisconsin 511), rail crossings, school zones at drop-off and pickup times, and fuel.
  4. Routes are ranked safest first, then by fuel, then by time, and each one gets a reason, like “safest: fewest risky turns”.
  5. The web map draws the routes and explains the pick. There are bike, walking and bus modes too.

Decisions I made

  • Safety strictly first. A safer route wins even when it’s slower, and the page says what that costs: here, about six minutes per trip on average.
  • Design its own routes instead of only re-ranking Google’s. Google can then time them with live traffic next to its own suggestions, so the comparison is fair.
  • Keep it free to run. A daily cap on live Google requests and a cache of answers mean an expo crowd can’t run up a bill.
  • Every route comes with a one-line reason, so drivers can see why it was picked.

The hard part: proving it works

Testing a map you can click, drag and undo. SafeMaps has 331 automated tests that run on every push with no network, including browser tests that click, drag, right-click, undo and swap the start and end on a small test city.

In numbers

  • 17 / 20test trips got a safer route than the standard one
  • 41 → 70average safety score (0 to 100), standard → SafeMaps
  • 51 → 9risky turns, across all 20 trips
  • 14 → 4lane closures on the way
  • 48 → 19rail crossings
  • +6.3 minper trip on average: the price of the safer choice

From the project’s own evaluation of 20 Milwaukee trips (safe-economy profile, live traffic off). In all, the safer routes used 1.99 gallons more fuel.

The portfolio demo replays recorded routes, planned with OpenStreetMap data only.