The Battle of the Bulge as an Animated Map with the ArcGIS Maps SDK
I was watching the Netflix World War II series Behind Enemy Lines, season 1, episode 3, about the Battle of the Bulge. I was always interested in this. I remember that, a long time ago, Henry Fonda made a movie about the Battle of the Bulge that I watched when I was a kid. I was always fascinated by that battle and I wanted to always have a visual representation of it. This is the implementation of it.
The Wikipedia article is full of place names (St. Vith, Elsenborn, Bastogne, Celles, Houffalize) and dates, but I cannot hold six weeks of a moving front in my head. The static maps help, but each one shows one day. I wanted to watch the bulge grow and shrink, with the story told next to the map, almost like a strategy game. So I built it as a single web page on top of the ArcGIS Maps SDK for JavaScript.
You can play it now: live app. The code is on GitHub: mraad/battle-of-the-bulge.
What you see
The page runs from the German plan in autumn 1944 to 28 January 1945. At 1× speed, the clock moves about 0.3 days per second. These things move with the clock:
- The German-held ground, as a red area that morphs between dated front lines.
- 32 units, drawn as NATO-style symbols (US blue, British tan, German red), each on its own route. Click a unit to read about it.
- Encircled pockets: the Schnee Eifel, Peiper at La Gleize, Bastogne, and the 2nd Panzer near Celles.
- The weather: fog that grounds the Allied aircraft, then clear skies from 23 December with planes and supply drops over Bastogne.
- Force bars for men and tanks, from the Wikipedia force tables.
The timeline at the bottom has seven chapters and 47 event markers. In story mode, the animation stops at 26 key moments and shows a briefing card. Press Space to continue. Turn story mode off and the whole battle plays in about two and a half minutes.
Where the lines come from
The narrative, dates and figures come mainly from the Wikipedia article. The front lines are my traces of six dated maps: the Wacht am Rhein map on Wikimedia Commons for 16, 20 and 25 December, and the US Army Ardennes Counteroffensive map for 3, 16 and 28 January. I added intermediate keyframes where the six maps leave a big gap, for 15 keyframes in all. I placed the 68 towns with the ArcGIS World Geocoder. The basemap is Esri World Shaded Relief, multiplied with World Imagery and World Hillshade, with a sepia effect on top so it looks like an old field map. These services are public, so the app needs no API key, no framework and no build step. One line loads the SDK:
<script type="module" src="https://js.arcgis.com/5.2/"></script>
After that, it is an <arcgis-map> component, a few GraphicsLayers for the front and the pockets, and a DOM overlay for the unit symbols, positioned with view.toScreen on every frame.
The hard part: making a front line morph
The obvious way to animate between two front lines is to resample both to the same number of points and interpolate point by point. I tried that first, and it looked wrong. The front on 16 December is almost straight. The front on 20 December has a horseshoe around St. Vith and a long tongue toward the Meuse. With plain resampling, point 150 is near St. Vith on one day and halfway to Bastogne on the next. So the St. Vith horseshoe slid down the line during the animation instead of growing in place.
The fix is to tag the same features in every keyframe. Each keyframe marks four anchors: the Elsenborn shoulder (e), St. Vith and the Salm (v), the tip (t) and Bastogne (b). The code cuts every line at these tags and resamples each section to a fixed count. So a section always morphs into the same section. Here it is, from model.js:
const TAGS = ["e", "v", "t", "b"];
function sections(pts) {
const idx = [0, ...TAGS.map((tg) => pts.findIndex((p) => p[2] === tg)), pts.length - 1];
return idx.slice(1).map((j, k) => pts.slice(idx[k], j + 1).map((p) => [p[0], p[1]]));
}
const SECT = FRONTS.map((f) => sections(f.pts));
const avg = SECT[0].map((_, k) => SECT.reduce((s, secs) => s + length(secs[k]), 0) / SECT.length);
const total = avg.reduce((a, b) => a + b, 0);
const COUNTS = avg.map((l) => Math.max(10, Math.round((N * l) / total)));
Each line has 400 points in total. A light moving average (radius 3, one pass) rounds the corners, and a smoothstep easing makes the line slow down at each keyframe. My first smoothing was stronger, and it pulled the Celles tip back from where the 2nd Panzer actually stopped. So the radius is small on purpose.
Testing a story
A map that looks good can still tell the story wrong. A small Node script (npm test) checks the data against the history:
- The animated front never crosses itself, checked every 0.05 days (72 minutes).
- Towns that never fell (Elsenborn, Malmedy, Marche, Dinant, Liège, Echternach) stay on the Allied side.
- Bastogne is surrounded from 20 to 26 December and Allied after that.
- Each unit stays on its own side of the line.
- Clock times in the event text (for example 05:30 for the barrage) match the event time, and dates format the same in every time zone.
The unit check was the useful one. My first pass had 32% of the unit samples on the wrong side of the front, mostly because my unit routes and my front lines came from different maps. I fixed the routes and added a keyframe for 18 December. The test samples every unit twice a day and forgives a sample inside its own pocket or within about 4 km of the front. Now 4 samples out of about 2,000 (0.2%) are still on the wrong side. The minute check found a real bug too: the clock showed 16:48 for an event at 16:50, because of floating-point days. Now the times round to the minute.
The animation ran at 60 fps in headless Chrome on one M4 Max machine. That is one machine, not a benchmark.
What it is not
The front lines and the unit positions are illustrative. Between two dated maps, everything is interpolated, and real fronts did not move in smooth curves. Where the sources disagree (the end date of 25 or 28 January, the weather clearing on 23 or 24 December, Bastogne cut off on 20 or 21 December), the event text says so. I tested in Chrome only, not in Safari, Firefox or on a phone.
I built this with Claude Code as my pair programmer, and the bench work was the same as always: trace, test, look at the screenshot, fix. One obvious next step is to check my traced lines against the daily 12th Army Group situation maps, which are online at the Library of Congress. If you know the battle well and see a line in the wrong place, open an issue on the repo. More to come.
Comments