feat/atlas-scan
needs attentionviewing older commite997fd8 · fullpre-PRreviewed 2026-07-17 23:53 UTC1H · 4M · 6L · 4I- Purpose
- Enrich the Batu energy atlas with infrastructure siting data — gas pipeline network and aquifer availability — to support industrial site selection decisions.
- Goal
- Add two new toggle layers to the Atlas: CENAGAS national gas pipeline network (authoritative route/permit/tariff-zone data + OSM laterals) and CONAGUA 2023 aquifer water availability (653 aquifers, deficit or available).
- Sub-goals
- SG-1: Natural gas pipeline layer from CENAGAS/SISTRANGAS (authoritative) + OSM (branch lines), with CRE permit/tariff-zone/operator popups
- SG-2: Aquifer water availability layer from CONAGUA (DOF 2023, CC BY 4.0) with deficit/availability classification and Mm³/año data popups
- SG-3: Attribution and source credits updated in about panel and map control
- What
- apps/web/public/atlas/index.html gains two new data sources, six new MapLibre layers (gas-glow, gas-lateral, gas, acui-fill, acui-line), two new click handlers with popups, cursor wiring, and two toggle entries. Two GeoJSON data files added: gas_pipelines.geojson (158 KB) and acuiferos.geojson (690 KB).
- Why
- Solar and industrial project siting requires knowing gas infrastructure proximity and water availability. Adding these layers makes the Atlas a more complete siting tool.
- Areas
- apps/web/public/atlas/index.html+20−5apps/web/public/atlas/data/gas_pipelines.geojson+1−0apps/web/public/atlas/data/acuiferos.geojson+1−0
- Blast
- 3 files, +22/−5 across apps/web/public/atlas/ only. No TypeScript, no backend, no database, no CDK. Atlas-only change.
Findings · 14
correctness5
e.features[0] accessed without guard in both new click handlers
apps/web/public/atlas/index.html
MapLibre can deliver empty features[] on polygon sliver clicks. Throws TypeError, kills popup, leaves cursor stuck. Guard with `if (!e.features?.length) return;`.
gas and gas-lateral have no beforeId — render above all point/symbol layers
apps/web/public/atlas/index.html
gas-glow is placed before 'lines-glow' but gas and gas-lateral have no beforeId — they land at the top of the stack, above plants/hubs/labels. Add beforeId to gas and gas-lateral.
p.n rendered as undefined for unnamed OSM gas segments
apps/web/public/atlas/index.html
OSM pipeline segments often lack a name tag. Use `p.n || '(ramal sin nombre)'`.
p.integ==1 loose equality — sensitive to schema changes in GeoJSON
apps/web/public/atlas/index.html
Works today. Fragile if future data refresh encodes integ as 'yes'/'no' strings. Low risk while GeoJSON is hand-authored.
Implicit dependency on 'lines-glow' existing for beforeId insertions
apps/web/public/atlas/index.html
addLayer(..., 'lines-glow') fails if atlas.json fails. Low risk in practice.
security2
GeoJSON properties interpolated into setHTML() without sanitization (two new popup paths)
apps/web/public/atlas/index.html
Pre-existing pattern. Static files — low exploitability. DOMPurify.sanitize() would cover all 12+ popup paths at once.
MapLibre CDN script loaded without SRI hash — pre-existing
apps/web/public/atlas/index.html
Not introduced by this diff. Adding integrity attribute would pin to a known hash.
conventions2
Inconsistent FeatureCollection guard: extracted const for gas, inline for acuiferos
apps/web/public/atlas/index.html
Every other FeatureCollection is an extracted const. Extract acuiFC before addSource to match.
acui-fill cursor wiring is outside the shared forEach
apps/web/public/atlas/index.html
All other clickable layers use the forEach for cursor wiring. Add 'acui-fill' to the forEach and remove the standalone cursor lines.
tests2
acuiferos.geojson cond values not validated on data refresh
apps/web/public/atlas/data/acuiferos.geojson
match expression relies on exactly 'deficit'/'disp'. A CI assertion on the known vocabulary would catch additions cheaply.
No tests for static atlas HTML — acceptable
File is outside Vitest/Playwright scope. No precedent for other atlas data files.
improvement1
848 KB of GeoJSON fetched eagerly for hidden-by-default layers
apps/web/public/atlas/index.html
gas_pipelines.geojson (158 KB) + acuiferos.geojson (690 KB) are in the initial Promise.all. Both layers default to visibility:'none'. Apply the existing evoLoad lazy-load pattern.
seo2
llms.txt does not mention gas pipeline or aquifer layers
apps/web/public/llms.txt
Add '…, red nacional de gasoductos (CENAGAS/SISTRANGAS) y disponibilidad de acuíferos (CONAGUA 2023).' to the Atlas description.
CC BY 4.0 and ODbL attribution correctly present in-UI
Both licenses' attribution requirements satisfied in about panel and popups.
History · 16 commits
- 91aaedfsafeincremental0H · 1M · 1L2026-08-12 17:35
- cb8d915needs attentionincremental2H · 5M · 3L2026-08-12 17:29
- 4cbbe8aneeds attentionincremental0H · 3M · 8L2026-08-12 14:01
- 4aa3c02needs attentionincremental2H · 3M · 3L2026-08-12 02:35
- f5630b2needs attentionincremental0H · 4M · 5L2026-08-12 02:17
- 28fde5bneeds attentionincremental1H · 2M · 2L2026-08-12 01:53
- 0babe51needs attentionincremental1H · 2M · 5L2026-08-12 01:23
- 50e8a8cneeds attentionincremental3H · 5M · 7L2026-08-11 23:58
- 3af4686needs attentionincremental3H · 5M · 5L2026-08-03 20:07
- f5d3266needs attentionincremental0H · 3M · 8L2026-08-03 19:40
- 9f8b61aneeds attentionincremental0H · 2M · 3L2026-08-03 19:15
- ea51fa0needs attentionincremental1H · 4M · 4L2026-08-03 19:02
- 2b33f2fneeds attentionincremental0H · 1M · 1L2026-07-18 05:09
- 2f8cf79needs attentionincremental1H · 3M · 4L2026-07-18 00:59
- 1616332safeincremental0H · 0M · 1L2026-07-18 00:22
- e997fd8needs attentionfull1H · 4M · 6L2026-07-17 23:53current