Time Until Totality
This notebook was inspired by the post below. Points on earth see a total eclipse about once every 400 years. How long you have to wait is a different question.
Implementation
The map at the top of the page displays precomputed eclipse paths based on DE440 ephemeris for near-term eclipses and DE441 past the year 3,000. I largely farmed out the eclipse computation to Claude Code and cross-checked the accuracy, but although I believe it’s valid, I don’t make any academic claims here about correctness.
Displaying and querying the paths is a little tricky. The paths are displayed by way of pre-baked WebP raster image tiles, colored with Mapbox’s raster-color feature (which, for better or for worse, I wrote when I worked there). Years are encoded logarithmically as RGB triples and decoded and colored at runtime.
When the map is clicked, a zoom level 6 vector map tile is fetched, decoded, and the ID of all intersecting eclipse paths computed. Then, a GeoJSON path is fetched and displayed for each matching eclipse path. It’s a bit convoluted, but even with decimationa and aggregation, it wasn’t otherwise straightforward to display all 1,116 vector outlines.