Skip to content

Map Page Enhancements - December 18, 2025

Updates to /maps page to support cbdistricts API changes and improve user experience.

Changes

1. Data Freshness Display

  • Shows "Districts: YYYY-MM-DD" in the map header when data loads
  • Uses new version and updated fields from /api/v1/layers endpoint

2. Cache Invalidation

  • Tracks updated timestamp in localStorage
  • Automatically clears layer cache when district data is updated on the server
  • Prevents stale data from persisting across sessions

3. Michigan District Names

  • Updated getDisplayName() to prefer namelsad property
  • Supports MICRC (Michigan Independent Citizens Redistricting Commission) data format
  • Falls back to name property if namelsad not available

4. Party Color Fill Fix

  • Changed fill-color expression from case to match syntax
  • Matches pattern used by cbdistricts for consistency
  • Colors: Republican (#E91D0E), Democrat (#232066), default (#9ca3af)

Technical Details

Fill color expression (before):

['case',
  ['==', ['get', 'party'], 'Republican'], '#E91D0E',
  ['==', ['get', 'party'], 'Democrat'], '#232066',
  '#9ca3af']

Fill color expression (after):

['match', ['get', 'party'],
  'Republican', '#E91D0E',
  'Democrat', '#232066',
  '#9ca3af']

  • cbdistricts API changes: cbdistricts/docs/API-CHANGES-20251218.md
  • New layers: michigan-congressional, updated Michigan state layers with MICRC source