Skip to content
All projects

Case study · Build · 2026

Chain Routes

The developer side

A 3D terrain map of Sierra chain controls between Sacramento and Tahoe. It stores every change, so each storm can be replayed.

Chain Routes is a 3D terrain map of Sierra chain controls that saves every checkpoint every 10 minutes, since Caltrans publishes the current status only. Each storm between Sacramento and Tahoe can be replayed. It is built with Next.js, MapLibre, deck.gl and Supabase, and the snapshots it has stored since November 7, 2026 go public once the first build merges.

The Chain Routes passes map replaying a sample storm, with Sierra routes colored by chain control level over dark terrain and a status panel for each route
  • What it does

    A 3D terrain map of Sierra chain controls and closures, for deciding whether to drive up this weekend.

    See the developer side
  1. 01

    The problem

    Caltrans publishes chain controls as current status only. Nobody can look up what I-80 did last Saturday.

  2. 02

    What I did

    Built a map that saves every checkpoint every 10 minutes and lines it up with snowfall and the next storm at each summit.

  3. 03

    Where it stands

    Tested on sample storms, with snapshots stored since November 7. That history goes public once the first build merges.

Chain controls drop out of the record the moment they lift.

Chain Routes answers one question. Should I drive up this weekend, and when?

Caltrans publishes chain control status as current-only. Once controls lift, they’re gone from the feed, so nobody can check how long Donner sat at R-2 last Saturday or how fast it cleared.

So Chain Routes keeps its own record. Every 10 minutes it reads every checkpoint between Sacramento and Tahoe and stores each change.

The feed Chain Routes reads: Caltrans CWWP2

The passes and Tahoe share one map.

  1. Passes map

    Chain controls and closures on the Sierra passes from Sacramento to Tahoe, over snowfall on 3D terrain.

  2. Tahoe Basin map

    The lake loop and its summits, with Nevada 511 conditions placed on the same R-level ramp.

  3. Replay

    A scrubber that steps through each 10-minute frame. Watch a storm close the passes and clear them.

  4. Trip check

    Pick one of 16 routes and a departure up to 72 hours out. It estimates when you reach each summit and shows the NWS forecast for that hour.

  5. Summit pages

    13 pinned summits, each with current conditions and its last five storms.

  6. Storm log

    Each storm gets a page with its hours under control by route and its time to clear at each summit.

  7. Methodology

    Every source and formula in plain language, plus the full chart of status codes.

I started from what the feeds really send.

  1. 01

    Source check

    One script calls every source once

    CI runs it on every pull request

  2. 02

    Test fixtures

    Trimmed copies of live responses

    Nevada 511 samples written from its docs

  3. 03

    Tests

    Unit tests on saved responses and SQL migrations

    20 of 20 Playwright tests on sample storms

    Crawl 39 links, none broken

  4. 04

    Color review

    Deuteranopia simulated on each status step

    I kept R-2 and R-3, the closest pair at ΔE 13.3

  5. 05

    Schedule

    The snapshot job started November 7

    Runs 852 by November 12, with no failed jobs

From a live source check to the 10-minute schedule

Where a feed broke one of my assumptions, the parser or the rule changed to fit the feed.

What the data got wrong

The snow level sits right on the mountains.

I modeled the map on FireTrace, Dilum Sanjaya’s wildfire map. It recolors its imagery with a Mapbox paint property that MapLibre doesn’t have.

So Chain Routes repaints each USGS imagery tile in the browser onto a night blue-gray ramp. The ramp stays dark so every route keeps its contrast.

The map I modeled this on: FireTrace

  1. Snow level

    The NWS snow level at each summit, spread across the map. Ground above it turns frosty, under a labeled ice-blue line.

  2. Follows your trip

    The line uses the current hour, or your departure once a trip check is set. Snow level is a forecast and isn’t stored, so past replay frames leave it off.

  3. Conifers

    Cones on OpenStreetMap woodland at three times life size, mostly between 3,000 and 8,500 ft and thicker on north-facing slopes. Above the snow level they get white caps.

  4. Checkpoint posts

    Controlled checkpoints stand as posts in their status color. Up to six carry a chip like R-2 · since 4:10 AM, most severe first.

  5. Key events

    The first control on each route, closures and reopenings, each route’s peak and the all clear. Each row jumps the replay and flies to the checkpoint.

  6. Terrain height

    1x, 1.5x, 2x or 3x, saved in the link so a shared view opens the same way.

Here d is the distance to each pinned summit in km, never under 0.5. Frost covers ground above that level on a 384 by 384 elevation grid from zoom 9 terrain tiles, or zoom 10 for the Tahoe Basin. Away from the summits the line is an estimate.

A scheduled job keeps the record every 10 minutes.

  1. 01

    Caltrans and Nevada 511

    Chain control status

    Lane closures and road weather

  2. 02

    Snapshot job

    Supabase Edge Function

    Stores each change

    Checks every record’s time

    Runs on pg_cron every 10 minutes

  3. 03

    Postgres

    Its own chainline schema

    Public reads through views

    Shares a free project with Grid Watch

  4. 04

    Next.js site

    Passes and Tahoe maps

    Storm and summit pages

    Also reads NOHRSC snowfall grids from a GitHub Actions job twice a day, plus NWS forecasts

How a snapshot moves from the feeds to the page

When the database is missing or fails, the site reads the feeds directly. It shows one frame with no past, and the map keeps working.

Each number has one fixed definition.

Every day and time boundary uses Pacific time. Definitions stay fixed once published, so this season can be compared with the next.

  • hours(route, level)time when the highest checkpoint on the route sits at that level

A route counts while at least one checkpoint is above R-0. Overlapping checkpoints never double count.

  • storm openswhen a checkpoint on I-80, US-50, SR-89 or SR-267 leaves R-0 for 3 hours or more
  • spells mergewhen they fall less than 12 hours apart
  • time to clearhours from the last hour of snow depth gain over 0.5 in. to R-0 at every checkpoint near the summit

A Nevada basin segment reporting chains or a closure for 3 hours also opens a storm. A spell longer than 14 days counts as a seasonal closure and can’t start one.

A Saturday window runs 6:00 to 10:00 a.m. It counts as controlled if any checkpoint shows a status above R-0 in any frame inside it. I-80 is scored westbound and eastbound on their own.

  • thresholdmedian NOHRSC 24-hour snowfall at the summit for the period when controls went up

The summit page waits for 10 storms before it shows one, and prints the sample size beside it.

The live feeds broke a few of my assumptions.

I pulled every feed live before writing a metric. Each of these would have written false history.

  1. Caltrans sometimes serves an old copy of a file

    Risk
    Months-old readings written as fresh history
    Call
    Check record times, and mark a district down when nothing is newer than 2 hours
  2. Some weather stations stay in service long after their last reading

    Risk
    Readings up to 2,270 days old on the map
    Call
    Drop readings older than 3 hours
  3. District 3 lists each checkpoint several times with letter suffixes

    Risk
    One checkpoint counted three times
    Call
    Collapse matching rows into one
  4. The District 10 weather file ships malformed JSON

    Risk
    A whole district’s road weather fails to parse
    Call
    Repair the missing commas before parsing
  5. Nevada has no R codes

    Risk
    Two states on two scales
    Call
    Place each Nevada condition on the nearest step and print the Nevada wording beside it
  6. Supabase returns at most 1,000 rows per request

    Risk
    Replay frames and season numbers cut off with no error
    Call
    Page through every long read
  7. The Central Sierra Snow Lab reports no hourly depth

    Risk
    Time to clear at Donner drops to 12-hour resolution
    Call
    Read depth from Independence Camp and keep the lab’s water content

Built so a stale file can’t write false history.

  1. A line for each direction

    Eastbound and westbound have their own road lines, so a segment’s status follows the way you’re driving.

  2. Retention that keeps the numbers true

    Raw rows age out after 120 days. The rows that weekend odds and closure totals depend on stay.

  3. Truck-only codes on the R-1 step

    They restrict some traffic with no rule for cars.

  4. A schema of its own

    Chain Routes lives in a chainline schema inside the free Supabase project that runs Grid Watch.

  5. Its own secret for the schedule

    The cron call signs in with a random secret kept in Vault, so the service role key never goes there.

  6. The map loads after the page

    It starts 1.2 s after load on desktop and 2.5 s on a phone, or as soon as you interact.

Roads stay the brightest thing on the map.

Chain levels run from yellow to red over a near-black map, and closed roads turn white with a hatch. Every status prints its Caltrans code and plain meaning beside the color.

  1. Type

    Overpass for text and Overpass Mono for every code and reading.

  2. Feed down in gray

    When a feed goes quiet, the map keeps the last known status in gray and prints when the feed went down.

Color distance between neighboring status steps under simulated deuteranopia (ΔE)
ItemΔELightness
None to R-190.329 to 87
R-1 to R-223.187 to 70
R-2 to R-313.370 to 57
R-3 to closed59.257 to 100
Color distance between neighboring status steps under simulated deuteranopia (ΔE). Every pair stays at least 10 apart. R-2 and R-3 sit closest, and both print their code.

Tested on sample storms and waiting on a real one.

Between snapshots
10 min
Between snapshots
Summit pages
13
Summit pages
Routes in the trip check
16
Routes in the trip check
Unit tests passing
130
Unit tests passing

The last source check ran 29 sources with no failures and skipped Nevada 511, which needs a key. Its parsers are built from the published docs.

Lighthouse on mobile, run against sample data
ItemPerformanceAccessibilityBest practicesSEO
Passes map100100100100
Tahoe Basin map100100100100
Donner Summit page100100100100
Lighthouse on mobile, run against sample data. Read the map scores with care. Lighthouse stops before the map starts, so they measure the server-rendered page. With a laptop GPU at 4x CPU throttle, the map is ready in about 3.0 s at 375 px and 1.6 s at 1440 px.

What I still need to check.

Next

  1. The first real storm

    Swap the sample storm on this page for a real one once history builds.

  2. A live Nevada check

    Run the Nevada parsers against a real 511 key.

  3. A phone test

    Map timings so far come from a laptop. A real phone will differ.

  4. The snowfall upload

    Turn on the upload to Supabase storage. So far the grid job has run against NOHRSC with the upload off.

Known limits

  1. Up to 10 minutes old

    Chain rules change by the minute, so Caltrans QuickMap and Nevada 511 have the final word.

  2. No road forecast

    The forecast covers snow. It can’t say when Caltrans will put chains up.

  3. Early odds

    Weekend odds describe this season so far and carry little weight early on.

  1. Built

    A 3D terrain map of Sierra chain controls from Sacramento to Tahoe, saved every 10 minutes.

  2. Found

    130 unit tests pass, and the last source check ran 29 sources with no failures.

  3. By the numbers

    Unit tests passing
    130
    Sources in the last check, no failures
    29
    Routes in the trip check
    16
  4. The catch

    Every result so far comes from sample storms. The page is still waiting on a real one.

  5. Next

    Replace the sample storm with the first real storm once enough history builds up.