Dev.to
6/24/2026

Eclipse mechanics for programmers: turning ephemeris data into a "next eclipse from here" countdown
Short summary
Building an eclipse tracker requires solving two problems: predicting when an eclipse occurs and determining visibility from a specific location. Rather than computing orbital mechanics in the browser, bake precomputed eclipse data from NASA's canon into static JSON, then use point-in-polygon ray casting to determine visibility. Cache everything with service workers to enable offline functionality, making the app reliable even with poor connectivity.
- •Use precomputed eclipse catalogs (NASA's Five Millennium Canon) rather than computing orbital mechanics in JavaScript
- •Determine visibility with point-in-polygon ray casting tests against cached GeoJSON path boundaries
- •Implement service worker caching for offline operation; use requestAnimationFrame for accurate countdown timers
Generated with AI, which can make mistakes.
Is this a good recommendation for you?



