All Things Spatial
ATS Labs · ATS Brand · React · experimental

Nightfall

City lights (NASA Black Marble 2016) under a live day/night line

What it is

Nightfall renders the night side of the planet in real time. NASA's VIIRS Black Marble city-lights composite — the 2016 annual composite, the newest Black Marble in NASA GIBS, so the lights themselves are not live — sits beneath a live day/night terminator, all three twilight bands (civil, nautical, astronomical), the subsolar and sublunar points, the current moon phase and illumination, a ±24-hour time scrubber, and a time-lapse mode that sweeps the terminator around the globe. There is no Esri basemap in the app at all — the imagery is NASA GIBS WMTS.

The distinctive engineering is the terminator math. Rather than searching latitude-by-longitude for where the sun sets, Nightfall treats each twilight boundary as exactly what it geometrically is: the sun's altitude at any point equals 90° minus the great-circle distance to the subsolar point, so the region where altitude falls below a threshold h is a perfect geodesic circle — a spherical cap of radius (90° + h) centered on the antisolar point. Those boundaries are exact for a sphere, with sunset at −0.833° (atmospheric refraction plus the sun's own radius, not 0°), and they need no iteration: roughly a hundred times cheaper, and — critically — still correct near the equinoxes, where the per-meridian search method breaks because the night cap touches neither pole.

It is a portfolio piece and a conversation starter as much as a tool: an elegant, correct, visibly branded demonstration of ATS's cartographic and mathematical craft, suited to science communicators, educators, planetarium and museum contexts, and anyone who wants to see the shape of night on Earth.

The experience

The app opens on the live view: the night hemisphere sits opposite a glowing gold sun disc, city lights blazing across the dark side.

The data — where it comes from

Nightfall uses one imagery service and computes all geometry client-side; there is no basemap or credentialed service.

SourceWhat it providesRefreshCostAttribution
NASA GIBS — VIIRS Black Marble (2016 composite)City-lights night imagery, the 2016 annual composite — the newest Black Marble in GIBS — as WMTS tiles to level 8Static composite (anonymous WMTS)Public, no keyNASA GIBS / ESDIS
suncalc (client library)Solar & lunar position, moon phase & illuminationRecomputed per minute (or per tick)Open source (BSD-2-Clause)V. Agafonkin (suncalc)
Terminator & twilight geometryGeodesic twilight caps computed in-browserPer refresh / per scrub tickIn-app (no service)ATS (src/lib/terminator.ts)

How it was assembled

Nightfall is an ATS-branded React 19 + Tailwind 4 application on the ArcGIS Maps SDK for JavaScript. It carries no Esri UI widgets.

Engineering decisions worth calling out