Skip to content

Drew the region map over a basemap shipped with the page instead of CARTO's - #307

Merged
CodyCBakerPhD merged 5 commits into
mainfrom
claude/peaceful-dijkstra-r9gpps-drop-carto
Nov 13, 2026
Merged

CodyCBakerPhD merged 5 commits into
mainfrom
claude/peaceful-dijkstra-r9gpps-drop-carto

Conversation

@CodyCBakerPhD

@CodyCBakerPhD CodyCBakerPhD commented Nov 13, 2026 •

Copy link
Copy Markdown
Collaborator

Why

The region map's basemap came from CARTO. Every visit sent the visitor's IP address, browser, the site's address and the map tiles viewed to CARTO. Since CARTO began requiring an API key, the map had been falling back to a plain background (#300, #303). This drops CARTO entirely.

Change

  • Basemap: Natural Earth's land and country borders at 1:110m (public domain), via the world-atlas package (ISC), bundled into the page by Vite (about 100 KB).
    • world_basemap_style(theme) builds a three-layer MapLibre style: a sea background, a land fill and a border line, in colors added to each theme (mapWater, mapLand, mapBorder).
    • The style names no URL, so drawing the map fetches nothing and contacts no one, and there's nothing to fail to load.
    • CARTO's place names (continents, oceans) go with it. Labels would need self-hosted font glyphs; the hover label still names each region.
  • Two pitfalls in the data, each covered by a unit test that fails if it comes back:
    • Plotly draws a choropleth just above any layer whose id starts with water (choroplethmap.getBelow). A background named water put every region under the land, so the background is named sea.
    • Natural Earth's outlines are spherical, and four of them cross the antimeridian (Fiji, Wrangel Island, Afro-Eurasia via Chukotka, and Antarctica). MapLibre drew those crossings as lines across the whole map, so each ring is unwound past ±180° (MapLibre draws that on the neighboring world copy), and Antarctica's ring, which circles the pole, is closed along −90°.
  • Removed: the CARTO style fetch, its label rewrite, its validity check and the redraw-on-failure from Drew the region map over a plain basemap when CARTO's cannot be loaded #300, plus the key wiring from Passed CARTO the API key its basemaps now require #303 (__CARTO_API_KEY__, CARTO_API_KEY in refresh-pages.yml/preview.yml, and the README section). If you created the CARTO_API_KEY Actions variable, it can be deleted.
  • Credits: "Geographic boundaries are defined by GADM v4.1 | Basemap from Natural Earth", replacing CARTO and OpenStreetMap.
  • Tests:
    • Replaced the CARTO unit tests with tests that the style is self-contained, fetches nothing from CARTO or OSM, uses the theme's colors, credits correctly, and avoids both pitfalls.
    • Removed the CARTO mock from page-mocks.js.
    • Re-recorded the four screenshot baselines.
    • Live-test comments no longer mention a live basemap.
  • Version 1.25.0 → 1.26.0.

Verification

  • Unit tests: 427 pass, including after merging main with Marked the over-time plot's y-axis when it is a log scale #305. The pitfall test fails with either fix reverted.
  • Playwright e2e: 10 pass. Visual: 6 pass against the re-recorded baselines; the old baselines also passed here, which confirmed this environment renders like CI.
  • Built page in Chromium over live data, dark and light, at 1200px and 390px:
    • All regions drawn over the new basemap (5,530 rendered features in the countries view).
    • No stray lines, and no console errors.
    • No requests to CARTO.
  • Time until the regions first appear: about 4.9–5.6 s, the same as Drew the region map over a plain basemap when CARTO's cannot be loaded #300's plain-background build. It's dominated by the 14 MB GADM file, not the basemap.
  • Chromatic will show diffs for the map snapshots; those are this change.

Note

Together with #306 (self-hosted font), the page then contacts only GitHub (the site and its data) and, for the points map only, Plotly's CDN.


Generated by Claude Code

The region map's basemap came from CARTO, so every visit sent the
visitor's address to CARTO, and since CARTO began requiring an API key
the map had fallen back to a plain background.

It is now drawn over Natural Earth's land and country borders at 1:110m
(public domain, via the world-atlas package), bundled with the page and
colored to the theme. The style names no URL, so drawing the map asks
nothing of anyone and has nothing to fail to load. CARTO's place names
go with it, as labels would need font files.

Two things the data needed: a background layer named "water" would have
put the choropleth under the land (Plotly draws it just above such a
layer), and Natural Earth's outlines cross the antimeridian, which
MapLibre draws as lines across the whole map, so they are unwound and
Antarctica's is closed along the pole.

The CARTO key wiring, its fallback and its redraw-on-failure go too,
and the credits name Natural Earth in place of CARTO and OpenStreetMap.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DQrzw4SjDXZ3UDtpvtyije
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DQrzw4SjDXZ3UDtpvtyije
…tra-r9gpps-drop-carto

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DQrzw4SjDXZ3UDtpvtyije
@github-actions

github-actions Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Preview removed because the pull request was closed.

@codecov

codecov Bot commented Nov 13, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.48%. Comparing base (1055400) to head (636b185).
⚠️ Report is 7 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #307      +/-   ##
==========================================
+ Coverage   98.35%   98.48%   +0.13%     
==========================================
  Files           4        4              
  Lines        1638     1649      +11     
  Branches      439      440       +1     
==========================================
+ Hits         1611     1624      +13     
+ Partials       27       25       -2     
Flag Coverage Δ
integration 42.93% <96.29%> (-0.35%) ⬇️
unit 98.42% <100.00%> (+0.19%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/plots.ts 98.05% <100.00%> (+0.17%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Natural Earth's land, bundled with the page, only ever comes as
MultiPolygons, so the branch for a plain Polygon could not run.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DQrzw4SjDXZ3UDtpvtyije
@CodyCBakerPhD CodyCBakerPhD self-assigned this Nov 13, 2026
@CodyCBakerPhD
CodyCBakerPhD marked this pull request as ready for review November 13, 2026 05:20
…tra-r9gpps-drop-carto

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DQrzw4SjDXZ3UDtpvtyije
@CodyCBakerPhD
CodyCBakerPhD merged commit 86ffbaa into main Nov 13, 2026
19 checks passed
@CodyCBakerPhD
CodyCBakerPhD deleted the claude/peaceful-dijkstra-r9gpps-drop-carto branch November 13, 2026 05:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants