Skip to content

feat: add hex map toggle for US congressional districts#631

Open
SakshiKekre wants to merge 1 commit intomainfrom
feat/us-hex-map
Open

feat: add hex map toggle for US congressional districts#631
SakshiKekre wants to merge 1 commit intomainfrom
feat/us-hex-map

Conversation

@SakshiKekre
Copy link
Collaborator

Summary

  • Add toggle to switch between geographic (natural boundaries) and hex grid views for congressional district maps
  • Hex map shows each district as an equal-area shape, eliminating visual distortion where large rural districts dominate

Changes

New files

  • congressional_districts_hex.geojson - Hex layout GeoJSON (based on Daily Kos/Downballot v3.1)
  • MapTypeToggle.tsx - Toggle component for Geographic/Hex grid
  • MapTypeToggle.test.tsx - Unit tests for toggle

Modified files

  • USDistrictChoroplethMap.tsx - Support both visualization types
  • utils.ts - Fix Plotly geo config for hex maps (no projection, fitbounds only)
  • types.ts - Add MapVisualizationType and optional geo config properties
  • AbsoluteChangeByDistrict.tsx / RelativeChangeByDistrict.tsx - Add toggle to pages
  • README.md - Document 119th Congress compatibility and design decisions

Technical notes

Why irregular "blob" shapes instead of uniform hexagons?

The hex map uses irregular polygon shapes by design:

  1. The artistic arrangement packs 436 districts into a recognizable US shape
  2. In dense areas (NY, CA urban districts), some districts are only 0.5 units apart
  3. Uniform hexagons (requiring ~1.0 unit spacing) would overlap
  4. The blobs tessellate like puzzle pieces to avoid overlap

119th Congress compatibility

  • All 436 district IDs match between hex map and 119th Congress natural boundaries
  • The 5 states that redistricted (AL, GA, LA, NY, NC) kept the same number of districts
  • Only PR-98 (Puerto Rico) is missing from hex map (non-voting delegate)

Test plan

  • Toggle appears on congressional district pages
  • Geographic view works as before
  • Hex view renders correctly with proper colors
  • Hover tooltips work on both views
  • Toggle state persists while viewing the page

@vercel
Copy link

vercel bot commented Feb 3, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
policyengine-app-v2 Ready Ready Preview, Comment Feb 3, 2026 8:51am
policyengine-calculator Ready Ready Preview, Comment Feb 3, 2026 8:51am
policyengine-website Ready Ready Preview, Comment Feb 3, 2026 8:51am

Request Review

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.

1 participant