BA // NEON 3D — Buenos Aires Urban Digital Twin
Real-time 3D urban digital twin and geospatial telemetry platform for Ciudad Autónoma de Buenos Aires (CABA) built with 0% mock data across 40 verified public sources, 1,386,437 real photogrammetry 3D buildings, and a synchronized triple-engine WebGL2 pipeline (MapLibre GL JS v5 + Three.js r149 + deck.gl v9) sustaining 59–60 FPS.
Code Specs
Experiment Objective
To ingest and stream 168 MB of official GCBA photogrammetry shapefiles (1,386,437 building polygons) and 40 heterogeneous public and live CABA datasets into a unified, zero-jitter triple-engine WebGL2 canvas running at 59–60 FPS (1920×1080) without V8 heap exhaustion or native C++ runtime dependencies.
Telemetry & Metrics
Live Walkthrough & Video Demo
Real-time orbital capture across Obelisco, Monumental, Puerto Madero, Au. 25 de Mayo 3D viaduct, 24h AUSA traffic streams, SAME hospital arcs, and the 48-barrio comparator.
Environment & Runtime
Key Features
- ⚡ Streaming Tile-Bucket ETL Pipeline: Processes 168 MB of GCBA photogrammetry shapefiles in constant V8 memory into 94 gzipped .pbf tiles (z11–z14, 65.9 MB) plus 3D height stats across all 48 barrios.
- ⚡ Zero-Jitter Triple WebGL2 Engine: Synchronizes MapLibre GL JS v5 extrusions, 14 procedurally sculpted Three.js landmarks on a unified local CABA meter origin, and 30+ animated deck.gl v9 layers.
- ⚡ 40 Verified CABA Sources (0% Simulated Data): Integrates 33 WGS84 CABA-clipped GeoJSON layers (GCBA, AUSA, SBASE, AGC, SUACI) with 5 resilient live APIs (Ecobici GBFS, OpenSky ADS-B, SMN, Open-Meteo, Epok).
- ⚡ TTL Cache with In-Flight Deduplication & Stale Fallback: Coalesces concurrent upstream fetches per feed and degrades gracefully to the last valid snapshot (stale: true) during external API outages.
- ⚡ Sub-15ms Spatial Inspector & SAME 3D Arcs: Exact ray-casting Point-in-Polygon across 48 barrios, Haversine 500m urban density KPIs, 24h AUSA radar sparklines, and emerald 3D arcs to the 3 nearest hospitals.
- ⚡ In-Stream SMP Cadastral Geocoding & 48-Barrio Comparator: Resolves missing AGC commercial permit coordinates directly from parcel geometry centroids and drives interactive side-by-side barrio rankings and 3D choropleths.
Core Hypothesis & Outcomes
Demonstrates that partitioning 1,386,437 photogrammetry footprints into 94 LOD-progressive MVT tiles (65.9 MB MBTiles served in < 2 ms via Node 24 native node:sqlite) and anchoring 14 procedural Three.js landmarks to a single local CABA meter origin completely eliminates Float32 GPU jitter and V8 OOM crashes, sustaining 59–60 FPS across 30+ animated deck.gl layers, 5 TTL-cached live feeds, and sub-15 ms Haversine/Point-in-Polygon spatial inspections.
Engineering Architecture: BA // NEON 3D (CABA Urban Digital Twin)
Full-stack architecture and geospatial engineering report of BA // NEON 3D (09-gemini-neon-swarm), a real-time 3D urban digital twin for the Autonomous City of Buenos Aires (CABA) built with 0% simulated data across 40 verified public datasets and live APIs (GCBA, AUSA, SBASE, AGC, SUACI, USIG, Ecobici GBFS, OpenSky ADS-B, SMN, and Open-Meteo). The engine streams 1,386,437 real photogrammetry building footprints from a 65.9 MB SQLite MBTiles server while synchronizing three WebGL2 renderers in a single canvas at 59–60 FPS (1920×1080).
Real-Time Urban Capture & Keyframe Inspection
Select any high-definition frame captured directly from the live WebGL2 engine to inspect the Gemini Glass HUD, 3D extruded cadastral blocks, sculpted landmarks, and spatial telemetry overlays:
1. Breaking the Three Barriers of City-Scale Web GIS
Rendering an entire metropolis with verified cadastral accuracy confronts three simultaneous engineering bottlenecks that break conventional web mapping applications: (1) extreme geometric volume (GCBA’s 168 MB Tejido Urbano shapefile holds 1,386,437 polygons that immediately exhaust V8 heap memory if loaded as GeoJSON), (2) source heterogeneity & upstream fragility across 33 static datasets (Latin-1/UTF-8 mojibake, ungeocoded SMP parcel keys) and 5 rate-limited public APIs, and (3) shared-context WebGL state contention across three distinct 3D engines.
BA // NEON 3D operates like three laser-calibrated projectors aimed at a single glass canopy: MapLibre GL JS v5 streams the quadtree pyramid of 1.38M extruded buildings on demand; Three.js r149 bolts 14 clockwork architectural models (Obelisco, Monumental, Puente de la Mujer, Floralis Genérica) onto a unified local meter origin; and deck.gl v9 overlays holographic 3D viaducts, 24h AUSA traffic particles, Aeroparque ADS-B flight trails, and SAME emergency arcs—all sharing one camera projection matrix at 60 FPS.
M_proj = M_maplibre · T(originMerc) · S(s, -s, s) · R_x(π/2) [Origin: -58.405°, -34.605°] y_TMS = (2^z - 1) - y_XYZ ⇒ O(log T) SQLite index lookup (T = 94 tiles, < 2 ms) z11: h ≥ 30m (tol 12) → z12: h ≥ 15m (tol 8) → z13: h ≥ 8m (tol 5) → z14: h ≥ 2m (1.38M bldgs) |Δφ| ≤ r / R_earth ∧ |Δλ| ≤ r / (R_earth cos φ) ⇒ prunes > 96% points before trig 2. Three-Plane Topology & Hierarchical 3D Inspection Flow
The runtime is partitioned into three strictly decoupled planes across 17,271 lines of ESM code:
Plane 1 · Offline Streaming ETL (scripts/)
ingest-caba-data.js (2,403 LOC) downloads, repairs UTF-8 encoding, and clips 33 official datasets to the CABA bounding box. build-tejido-tiles.js (741 LOC) streams 1.38M polygons into disk-backed NDJSON tile buckets to compile caba-tejido.mbtiles (65.9 MB) and barrios-stats.json.
Plane 2 · Dual-Port Node 24 Backend (:3005 / :8005)
server.js isolates static UI delivery (:3005) from the REST/MVT API (:8005) powered by 4 zero-native-addon modules: mbtiles.js (node:sqlite), live-feeds.js (TTL + stale fallback), spatial-inspect.js (PiP + Haversine), and search-index.js (USIG live + fuzzy).
Plane 3 · Hybrid WebGL2 Client & Picking
Clicking any 3D structure runs hierarchical picking (Three.js → deck.gl → MVT tejido-3d), fires GET /api/inspect, renders parcel SMP KPIs + 24h AUSA SVG sparklines, and projects glowing emerald 3D arcs to the 3 nearest SAME public hospitals.
3. Architectural Decision Records (ADRs) & Engineering Trade-offs
| Architectural Decision | Alternative Rejected | Engineering Rationale & Measured Impact |
|---|---|---|
Node 24 native node:sqlite | Client GeoJSON or external PostGIS / Docker tile server | Zero C++ native compilation (no better-sqlite3); serves gzipped .pbf tiles in < 2 ms with automatic mtimeMs hot-reload and shrinks 168 MB shapefiles to 65.9 MB. |
NDJSON Tile-Bucket Streaming | In-memory FeatureCollection passed to geojson-vt | Prevents > 6 GB V8 heap OOM crashes by partitioning polygons on disk per (z, x, y) during shapefile streaming and committing all 94 tiles in a single atomic SQLite transaction. |
Single Local CABA Origin | Per-landmark Mercator matrices or raw global coordinates | Eliminates WebGL Float32 vertex jitter by keeping all 14 sculpted landmarks inside [-10km, +10km] local meters and coupling once in CPU double precision per frame + renderer.resetState(). |
Dual-Port (:3005 UI / :8005 API) | Single monolithic Express port | Enforces clean CDN static vs stateless API boundaries, explicit CORS allowlisting, regex path-traversal protection (SAFE_LAYER_ID_RE), and independent cache headers. |
In-Flight Dedup + Stale-on-Error | Direct browser fetches to public government APIs | Prevents thundering herds and rate-limit bans on OpenSky, Ecobici, and SMN while guaranteeing 100% visual availability via stale: true snapshots during upstream outages. |
Post-Capture CFR Keyframes | page.screenshot() inside live CDP screencast loop | Eliminates 150–350 ms Chrome GPU compositor stalls during 1080p recording, maintaining locked 30 fps CFR H.264 output at 16 Mbps while WebGL renders at 59–60 FPS. |
4. Engineering Post-Mortems & Debugging Insights
Loading 168 MB of photogrammetry into RAM blew past V8 heap limits. Streaming polygons into per-tile NDJSON disk buckets with height LOD filtering reduced memory to O(1) constant footprint.
Thousands of official AGC business records lacked lat/lng and carried only cadastral SMP keys. Normalized SMP centroid extraction during the same tejido.zip pass geocoded every venue offline with zero API calls.
4K internal supersampling (deviceScaleFactor: 2) plus inline PNG screenshots paused frame delivery. Switching to native 1080p, VideoToolbox H.264 CFR (16 Mbps), and post-capture FFmpeg extraction eliminated all frame drops.
5. Verified 40-Source Catalog & Cloud Topology
Every dataset in data/manifest.json is auditable via the in-app Provenance Modal (40 Sources) across 5 urban domains:
- 3D Catastro & Photogrammetry (9): 1.38M extruded footprints (citywide mean
9.7m,10,041towers>45m), 14 Three.js landmarks, 48 barrios, 6,000 AGC works, USD/m² land value, and SUACI 147 claims. - Mobility, 3D Highways & Live Transit (11): AUSA elevated viaducts + 24h radar trips, LPR Anillo Digital, Subte A–H, Metrobús, 2,764 km bike lanes, Ecobici GBFS (30s live), and OpenSky AEP flights (15s live).
- Health, SAME & Public Safety (8): 36 SAME public hospitals, 65 private clinics, 50 CeSACs, 1,240 pharmacies, 75 police stations, and 28 fire brigades.
- Commerce, Culture & Live Climate (12): 7,156 AGC permits, 2,823 gastronomy venues, 3,031 cultural spaces, 2,746 schools, USIG live address normalizer, 354k street trees, and SMN + Open-Meteo 9-node wind/AQI (60s live).
Production Cloud Blueprint: Edge CDN caches immutable .pbf tiles and GeoJSONs (>92% hit rate, <25 ms P95) in front of stateless Google Cloud Run Node 24 containers mounting caba-tejido.mbtiles read-only with shared Redis TTL state and weekly build:data Cloud Run Jobs.