feat/atlas-intl
safeviewing older commit0480e20 · fullPR #334reviewed 2026-07-22 18:49 UTC0H · 1M · 5L · 3I- Purpose
- Add international electricity interconnection ties to the public Atlas SEN map, showing Mexico's cross-border grid connections with the US (WECC/ERCOT), Guatemala (SIEPAC), and Belize.
- Goal
- Provide a toggleable map layer showing the 6 major international interconnections of the Mexican National Electric System (SEN) with accurate source attribution.
- Sub-goals
- SG-1: New international_ties.geojson with 6 connections (Path 45 BCA↔CAISO, La Rosita–Imperial Valley, Laredo VFT, Railroad/Sharyland, Tapachula–Los Brillantes, Xul-Ha–Belize)
- SG-2: Wire 4 MapboxGL layers — solid AC lines, dashed DC lines, border substation circles, glow effect
- SG-3: Click popups with connection details (kV, MW, technology, operator group, source) and layer toggle control
- What
- Added static GeoJSON data file with 18 features (6 line geometries + 12 endpoint points) and wired 4 new MapboxGL layers with click handlers, a GROUPS entry, and a new TOGS toggle in index.html.
- Why
- International ties are a key dimension of the SEN missing from the atlas; completing this makes the map authoritative for energy professionals.
- Areas
- apps/web/public/atlas/data/international_ties.geojson+1−0apps/web/public/atlas/index.html+15−4
- Blast
- 2 files, +16/-4 lines; purely additive to the atlas static HTML — no backend, no Next.js routes, no database changes.
Findings · 10
correctness3
meta.n:6 counts line features only, not total features — ambiguous
apps/web/public/atlas/data/international_ties.geojson
meta.n=6 matches the 6 line-kind features, not the 18 total features (6 lines + 12 points). The HTML does not read meta.n at runtime, so this is non-breaking, but the opaque field name is misleading. Consider renaming to nLines or adding a comment.
Miguel (SDG&E) point coordinate is ~12 km east of the actual substation
apps/web/public/atlas/data/international_ties.geojson
The Miguel (SDG&E) endpoint is given as [-116.876, 32.717]. The actual SDG&E Miguel 230/500 kV substation is near Spring Valley / Chula Vista, CA at approximately -117.03, 32.71. The file labels traces as 'schematic between real border substations' so this is low-impact, but the coordinate is noticeably off for a point nominally representing a real substation.
sync filter logic is correct — no missing-field risk
apps/web/public/atlas/index.html
All 6 line features carry sync as an integer (4=1, 2=0). Point features lack sync but are excluded by the kind=='line' guard before sync is evaluated. No edge cases.
security2
GeoJSON properties interpolated unescaped into popup innerHTML
apps/web/public/atlas/index.html
The intlLine handler builds HTML via template literals from GeoJSON properties (p.n, p.mx, p.ext, p.pais, p.mw, p.tech, p.dir, p.year, p.grupo, p.src) without HTML escaping. Not exploitable externally — the GeoJSON is a static committed file. Pattern is identical to all pre-existing pop() calls in the atlas file; this diff introduces no new risk class.
No Content-Security-Policy headers on atlas page (pre-existing)
apps/web/public/atlas/index.html
Pre-existing gap not introduced by this diff. Low urgency given the static-data-only architecture.
conventions2
File uses .geojson extension — all existing data files use .json
apps/web/public/atlas/data/international_ties.geojson
All existing spatial data files in this directory (osm_substations.json, transmission.json, private_generation.json, etc.) use .json. The .geojson extension is technically more accurate but breaks the established convention and could affect glob-based tooling.
intl group omits a label layer — lines and tx groups include one
apps/web/public/atlas/index.html
Established line-group pattern: lines=['lines-glow','lines','lines-label'], tx=['tx-lines-glow','tx-lines','tx-lines-label','tx-subs']. The intl group is ['intl-glow','intl','intl-dc','intl-pts'] — no label layer. If labels are intentionally handled via the intl-pts point features (symbol rendering), this should be documented to prevent a future contributor from adding a duplicate layer.
tests1
No GeoJSON schema validation test — reasonable given no atlas test precedent
apps/web/public/atlas/data/international_ties.geojson
No automated test enforces that all line features carry kind/sync/kv/tech/n/pais and all point features carry name/side/tie. The atlas has no other data-validation tests, so there is no precedent. A lightweight Vitest test would guard against silent regressions from future hand-edits, but is not blocking.
improvement2
GeoJSON minified to one line — future diffs will be unreadable
apps/web/public/atlas/data/international_ties.geojson
The entire FeatureCollection (18 features) is on a single line. Any property change produces an unreadable diff and hand-editing is error-prone. Pretty-print with `jq .` or `prettier`; the extra bytes are negligible for a static asset served once.
GeoJSON missing trailing newline
apps/web/public/atlas/data/international_ties.geojson
Git marks the absence with '\ No newline at end of file'. Trivially fixed alongside a pretty-print pass.