Skip to content

chassis: bundle the US states sub-map (50 states + DC)#475

Closed
ChBrain wants to merge 1 commit into
mainfrom
claude/map-choices-us-spain-1bx6un
Closed

chassis: bundle the US states sub-map (50 states + DC)#475
ChBrain wants to merge 1 commit into
mainfrom
claude/map-choices-us-spain-1bx6un

Conversation

@ChBrain

@ChBrain ChBrain commented Jul 6, 2026

Copy link
Copy Markdown
Owner

What

Bundles the United States subdivision geometry so the cultures map can drill into the US the way it already drills into Germany and the UK. Two files, the same shape as the Germany change:

  • src/lib/us.geo.json — the 50 states + the District of Columbia as ISO 3166-2 (US-XX) features.
  • src/lib/de-map.ts — one line registering US in SUBMAPS, plus a comment documenting the source and coordinate convention.

How the Alaska/Hawaii problem is solved

The naive path — Natural Earth admin-1 in raw lon/lat — breaks: Alaska crosses the antimeridian (its Aleutians run to +179.8°), so the existing bbox-fit loader would blow the frame up to span the globe. Instead the geometry comes from us-atlas states-albers-10m (US Census Bureau cartographic boundaries, pre-projected with d3.geoAlbersUsa, so Alaska and Hawaii arrive already inset and rescaled).

The build step:

  1. Decodes the TopoJSON to GeoJSON.
  2. Rekeys features from FIPS to ISO 3166-2 (06US-CA).
  3. Rescales the planar 975×610 projection plane into a pseudo-degree frame centred on latitude 0, with the y-axis pre-flipped.

Centring on lat 0 makes the loader's cos(meanLat) width compression a no-op, and the pre-flip cancels the loader's own y-flip — so de-map.ts renders the canonical Albers USA composite with zero runtime code change. The coordinates are projection space, not real lon/lat; the SUBMAPS comment says so.

Verification

  • Ran the real de-map.ts loader under Node type-stripping: subMapFor("US") returns 51 outlines, no empty paths; US-DC, US-AK, US-HI all present; every code matches US-XX; DE/GB unaffected.
  • Rendered the geometry through a faithful port of the loader's projection math and screenshotted it — states correctly shaped (shared scale on both axes, no distortion), Alaska and Hawaii inset bottom-left.
  • Prettier passes with the repo config.

Full npm test (Astro build) wasn't run here — this sandbox can't reach the @chbrain GitHub Packages registry — so CI is the first full build.

Dormant until content lands

With no state cultures yet, the US node has no children and nothing drills in. When the first US-XX culture ships in khai-cultures, the culture-tree derives its nesting from the code, the world map's US marker flips from "download" to "open map", and this sub-map lights up — the state outline itself becomes the clickable link, so no marker-placement work remains.

Source / licensing

Data is US Census Bureau (public domain) via us-atlas (ISC). No new runtime dependency — the geojson is vendored, matching how de.geo.json/gb.geo.json already live in the repo.


⚠️ Branch-scope note: this diff is chassis work and the repo guard routes chassis to a chassis/* lane, but it was developed on the session's mandated claude/* branch — so the khai-guard branch-check gate will flag the branch name. The fix is a local rename to chassis/us-submap from this same commit; happy to prepare that handoff.

🤖 Generated with Claude Code

https://claude.ai/code/session_012AfbYrfJH4i991Uu8XeHrF


Generated by Claude Code

us.geo.json carries the 51 subdivision outlines (us-atlas states-albers-10m:
Census Bureau cartographic boundaries pre-projected with d3.geoAlbersUsa, so
Alaska and Hawaii arrive already inset), rekeyed from FIPS to ISO 3166-2
US-XX and rescaled into a pseudo-degree frame centred on lat 0 — there the
loader's cos(meanLat) width fit is a no-op and its y flip restores the
pre-flipped axis, so de-map.ts renders the Albers composite without any code
change. The world map drills into the US page once a state culture ships;
until then the entry is dormant.

Source data is public domain (US Census Bureau) via us-atlas (ISC).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012AfbYrfJH4i991Uu8XeHrF

ChBrain commented Jul 6, 2026

Copy link
Copy Markdown
Owner Author

Superseded by #476. Same diff, rebased onto the chassis/us-states-submap lane so the branch-scope gate passes (this branch was claude/*, which matches no lane). Closing in favor of #476.


Generated by Claude Code

@ChBrain ChBrain closed this Jul 6, 2026
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