Skip to content
Andrew Voirol
Monday, August 31, 2026artemis-velocity-vis

Leaflet camera tracking, SSR isolation, and coordinate heading synchronization

ReactPerformanceVisualization

Leaflet accesses global browser APIs (window, document) directly during module evaluation. Importing Leaflet into Next.js React Server Components triggers runtime ReferenceError: window is not defined exceptions and hydration mismatches.

1. Zero-Side-Effect Drop-In Isolation

<ArtemisFlightSimulator /> encapsulates Leaflet via client-only dynamic loading with a theme-aware skeleton fallback:

const MapComponent = dynamic<MapProps>(() => import('./Map'), {
  ssr: false,
  loading: () => <MapLoadingFallback themeId="nasa-dark" />
});

2. Spherical Heading Alignment

Instantaneous spacecraft heading θ\thetaθ is derived from lookahead vector P(p+ϵ)\mathbf{P}(p + \epsilon)P(p+ϵ):

θ=atan2⁡(sin⁡Δλcos⁡ϕ2, cos⁡ϕ1sin⁡ϕ2−sin⁡ϕ1cos⁡ϕ2cos⁡Δλ)\theta = \operatorname{atan2}(\sin\Delta\lambda \cos\phi_2, \, \cos\phi_1 \sin\phi_2 - \sin\phi_1 \cos\phi_2 \cos\Delta\lambda)θ=atan2(sinΔλcosϕ2​,cosϕ1​sinϕ2​−sinϕ1​cosϕ2​cosΔλ)

The bearing angle is applied directly to the L.divIcon DOM element via CSS transform: rotate(${heading}deg) to keep the nosecone aligned to the flight trajectory in real time.

← Previous

Real-time ground track speed, velocity scrubber, and Mach number telemetry

Next →

High-contrast E-Ink, NASA Mission Control Dark, and radar telemetry design


Andrew Voirol

Builder, hacker, shipper. Currently leaving localhost.

Navigate

WorkThreadsBuilder's LogAboutContactRSS Feed

Connect

X / TwitterGitHubLinkedIn

© 2026 Andrew Voirol·Back to top ↑
✦Just one prompt away from figuring it all out.