Cartography
Eight approaches to rendering the Earth — Canvas 2D point clouds, d3-geo projection morphing, Leaflet trajectory mapping, and raw GLSL shaders.
8 threads · 36 entries · 4 rendering approaches
Eight codebases, four rendering pipelines, one recurring problem: how to render geographic datasets interactively on a 2D screen while balancing projection distortion, GPU overhead, and garbage collection pressure.
This isn't a single project that grew — it's a problem I kept returning to. Every few months a new constraint surfaced: a new projection to support, a dataset too large for Canvas 2D, a flight path that exposed Mercator's lies about Great-Circle distance. Each time, the "correct" rendering approach turned out to depend entirely on the tradeoff being prioritized — fidelity, interactivity, or raw throughput.
The result is four distinct paradigms, each with its own rendering pipeline, performance ceiling, and set of hard-won tricks. Canvas 2D handles thousands of points with zero dependencies. Leaflet gives tile-map context but locks you into Web Mercator. D3 projection mutators let you morph between any two projections but fight you on the sphere-to-plane seam. WebGL removes the frame-rate ceiling entirely — at the cost of writing every vertex buffer and shader by hand.
Rendering Paradigm Matrix
| Paradigm | Primary Codebases | Rendering Pipeline | Key Technical Mechanics |
|---|---|---|---|
| Paradigm 1: Canvas 2D + d3-geo | Dot Matrix Globe, Globe → Map | HTML5 Canvas 2D, TopoJSON | Poisson disc point sampling, superellipse clipping, continuous D3 projection blending |
| Paradigm 2: Leaflet + Geodesics | Artemis Velocity Vis | Leaflet, GeoJSON, Canvas Layer | Spherical slerp interpolation, continuous velocity scrubber (500 to 25k mph), Mach 32 telemetry, E-Ink/NASA themes |
| Paradigm 3: D3 Projection Mutators | Interactive Globe, GeoGenesis | Canvas 2D, D3 Mutators, Angular/React | Pythagorean limb interpolation, multi-projection mutators (Winkel/Mollweide), 24-bit RGB picking |
| Paradigm 4: WebGL & GLSL Shaders | Rotating Earth, TerraGemini | Three.js / Raw WebGL, GLSL | O(1) vertex buffer slicing (250K pts), Blinn-Phong specular glint, 3×3 Sobel coastlines, MGRS telemetry |
Paradigm 1: Canvas 2D & Continuous Projection Morphing
Canvas 2D was the starting point because it's the fastest path to rendering geodata with zero dependencies beyond d3-geo — no build step, no WebGL context, no framework lock-in. The challenge was sustaining 60fps while morphing between two projections without triggering garbage collection pauses from per-frame object allocation.
- Dot Matrix Globe: Plots ~8,000 Poisson-disc points across Natural Earth TopoJSON landmasses stored in typed
Float32Arraybuffers with dynamic back-face culling (). - Globe → Map Transform: Morphs between orthographic and equirectangular projections via continuous blending factor and an adaptive superellipse boundary ().
Paradigm 2: Leaflet & Spherical Geodesic Telemetry
Web Mercator projects spherical meridians as parallel lines, making straight flat segments deviate significantly from true Great-Circle shortest paths. This high-contrast E-Ink flight deck visualizes real-time spherical slerp geodesics, continuous velocity modulation, and cartographic path divergence.
Loading Web Mercator tiles and Haversine spherical geodesic projection...
ARTEMIS
ORBITAL VISSpherical Geodesics • Telemetry Deck
- Continuous Velocity & Mach Scrubber: Real-time speed modulation from (subsonic aviation) to (lunar skip re-entry) with live Mach number calculations ().
- Spherical Slerp vs. Mercator Linear Chord: Interactive toggle revealing the () path error and lateral separation between true Riemannian spherical geodesics and naïve flat Mercator straight lines.
- High-Contrast E-Ink & NASA Dark Themes: Scoped GPU-accelerated CSS tile filter pipelines with active camera tracking and real-time heading vector alignment.
Paradigm 3: D3 Unfurling & Projection Mutators
Three distinct approaches to the geometric seam where visible front-face coordinates meet occluded back-face data during an unfold transition.
- GeoGenesis (React 1,053-line Canvas): Full projection laboratory featuring frame-by-frame Pythagorean limb departure (), dynamic horizon clipping (), multi-projection topology mutators (Winkel Tripel with 4th-order Taylor sinc guards and Mollweide equal-area via Newton-Raphson Kepler iteration), 24-bit bijective RGB country hit detection (), and Great-Circle Haversine SLERP flight arcs.
- Interactive Globe (344 lines): Solves hidden point emergence using the Pythagorean limb relation, sliding occluded points from the sphere's silhouette edge to their equirectangular slots.
- GeoGenesis (Angular 21): Implements
d3.geoProjectionMutatorto mutate the projection pipeline per frame with signal-driven zoneless change detection.
Paradigm 4: WebGL & Fragment-Level GLSL Shaders
When point density exceeds 50,000, CPU-side Canvas 2D loops experience frame drops. Offloading calculations to GPU fragment shaders enables rendering hundreds of thousands of points, raytraced specular ocean glints, and procedural coastlines at 60fps.
- Rotating Earth (Three.js + GLSL): Land masses defined via UV-space dot matrix, coastlines extracted with a Sobel edge-detection filter, and view-angle limb falloff producing atmospheric halo in ~50 lines of fragment shader.
- TerraGemini (Raw WebGL): 918 lines of handwritten WebGL with zero Three.js abstraction. Features GPU vertex buffer slicing from 50k to 250k points without PCIe reallocation, raytraced Blinn-Phong specular ocean reflection with scrubbable 3D solar vector, and WGS84 to MGRS 1-meter geodetic telemetry with screen-to-sphere raycasting.
Cross-Paradigm Benchmark
How the four rendering approaches compare across performance, complexity, and capability:
What Eight Codebases Taught Me
The biggest lesson wasn't about any single rendering technique — it was about the tradeoff surface itself. Canvas 2D is trivially debuggable but hits a hard ceiling around 10,000 animated points. Leaflet solves the tile-context problem but Mercator distortion makes every geodesic path a lie. D3's projection algebra is mathematically beautiful but the unfurl seam — where occluded back-face data meets visible front-face coordinates — requires frame-by-frame geometric surgery. WebGL removes every CPU bottleneck and introduces every GPU debugging nightmare in exchange.
If I were starting fresh, I'd reach for Canvas 2D for anything under 10K points, Leaflet for any work requiring real-world geographic context, and WebGL for anything where point density or visual fidelity matters more than development speed. D3 projection mutators remain the only option when you need to morph between arbitrary projections — nothing else in the ecosystem does that.
Related Threads

Building the Dot Matrix Globe
From Natural Earth TopoJSON to a theme-reactive, 60fps canvas globe — ~8,000 dots plotting the Earth as ambient generative art.

Building the Globe → Map Transform
Morphing a 3D globe into a flat map with real projection math — custom d3 projection interpolation, back-face culling, and great-circle connection arcs.

Artemis Velocity Vis
From AI Studio export to an interactive mission control orbital mechanics laboratory — velocity scrubbing (500 to 25,000 mph), Mach 32 telemetry, Catmull-Rom skip entry modeling, and real-time Geodesic vs. Mercator distortion comparison.

Building the GeoGenesis Unfold
An AI Studio D3 globe export becomes a buttery orthographic-to-equirectangular transition — through clip artifact rewrites, hemisphere math, and one very important minus sign.

GeoGenesis: mathematical projection unfurling and geodesic routing
1,053 lines of Canvas 2D, continuous Pythagorean limb departure unfurling, multi-projection topology mutators (Winkel Tripel & Mollweide), 24-bit RGB country hit-testing, and Haversine SLERP flight arcs.

Interactive Globe
An AI Studio export with genuinely clever math — a custom D3 projection interpolator that unfurls a 3D globe into a flat map and back.

Dot-matrix globe: GLSL coastlines on a specular map
The easiest AI Studio rescue — a 3D rotating Earth built entirely in custom GLSL shaders. UV-space dot grid, Sobel coastlines, and atmospheric glow in ~50 lines of fragment shader.

TerraGemini: raw WebGL globe and planetary telemetry
918 lines of raw WebGL, Blinn-Phong specular ocean glint, 3×3 Sobel coastline convolution, O(1) vertex buffer slicing up to 250,000 points, and military MGRS telemetry.