← all branches

feat/atlas-sat

safe
55942ab · incrementalPR #353reviewed 2026-07-28 02:12 UTC0H · 1M · 4L · 1I
The branch
Purpose
Batu Atlas public energy map for Mexico — UX enhancements across satellite basemap, owner search, and attribution placement
Goal
Add satellite basemap toggle with state borders, searchable owner filter combobox, and fix attribution overlap
Sub-goals
  • SG-1: Esri World Imagery satellite basemap with scrim and lazy-loaded state borders
  • SG-2: Accent-insensitive combobox owner filter preserving plant-count order
  • SG-3: Attribution moved to bottom-right, collapsed to ⓘ on load, deduplicated
The changes (whole branch)
What
Single file change to apps/web/public/atlas/index.html (+107/-7). This commit adds the lazy-loaded state borders: a satstates GeoJSON source (empty on init), a sat-states dashed line layer with opacity fade by zoom, and loadStateBorders() which fetches data/state_polys.json (84KB) only on first satellite activation.
Why
State borders in satellite mode help orient viewers at national scale while fading out at site-inspection zoom levels where they'd be visual noise.
Areas
apps/web/public/atlas/index.html+1077
Blast
1 file, +107/-7 lines total across the branch. Single static HTML file with no dependencies, no build step, no server-side effects.
static-page-only no-ts-no-build verified-manually-in-browser
ci· CI status unavailable (personal access token scope limitation)coderabbit· No .coderabbit.yaml in repo

Findings · 6

security1

low

No shape guard before .map() on fetched GeoJSON arrays

apps/web/public/atlas/index.html

If state_polys.json is corrupted or returns unexpected types, the chained .map() calls will throw and crash the atlas silently (the .catch only handles fetch/parse errors, not .map() runtime errors inside the .then). A check that sp[n] is an Array before mapping would prevent a silent no-border scenario.

tests2

medium

Coordinate swap (lat/lng → lng/lat) not verified in test suite

apps/web/public/atlas/index.html

The transform `p => [p[1], p[0]]` was verified correct against the actual data format, but has no automated coverage. If state_polys.json is ever regenerated in a different format, borders would appear in the wrong hemisphere silently. A Playwright assertion checking rendered coordinates are within Mexico's bbox (~[-118,14] to [-86,33]) would guard this.

low

_statesLoaded=false error-retry path not in manual verification checklist

apps/web/public/atlas/index.html

The .catch handler resets _statesLoaded=false to allow retry on next toggle, but this path wasn't covered in the PR's documented manual verification. Low risk on a static page, but worth a Playwright test intercepting a 500 and confirming a second fetch fires on re-toggle.

improvement3

low

Coordinate swap readability: destructuring over index access

apps/web/public/atlas/index.html

`p=>[p[1],p[0]]` works but `([lat,lng])=>[lng,lat]` expresses intent more clearly and reduces risk when this line is edited in future. Minor given the file's intentionally dense style.

low

Sat layer id list duplicated in two places

apps/web/public/atlas/index.html

The sat layer ids (sat, sat-scrim, sat-states) appear in both addLayer calls and the setBasemap forEach. Adding another sat layer requires updating both locations. A const SAT_LAYERS=[...] at module scope would make this a single-edit change. Informational for this file's dense style.

info

Fetched GeoJSON not cached in memory — resilience note

apps/web/public/atlas/index.html

The data is pushed into the MapLibre source (which holds it) but not held in a module variable. If the source were ever cleared and re-added, _statesLoaded=true would suppress re-fetching. Not a current bug; purely informational.

History · 3 commits

  1. 55942absafeincremental0H · 1M · 4L2026-07-28 02:12current
  2. 744d655needs attentionincremental0H · 1M · 5L2026-07-28 02:04
  3. aec0922needs attentionfull2H · 3M · 2L2026-07-27 18:41