Proyecto personal · big data e IA · en marchaPersonal project · big data and AI · in progress

Lumiose Planner

Un gemelo digital de Barcelona que funciona en el navegador: los 69.911 edificios de la ciudad en 3D, con el tráfico, el Bicing, los buses, el metro y el tiempo de ahora mismo.

A digital twin of Barcelona that runs in the browser: all 69,911 buildings of the city in 3D, with the traffic, bike share, buses, metro and weather of right now.

Barcelona · en vivoBarcelona · live

Unos 40 MB de datos la primera vezAbout 40 MB of data the first time

69.91169,911
edificios del Catastrobuildings from the land registry
2.536 km2,536 km
de calles con tráfico simuladoof streets with simulated traffic
3.5173,517
cruces con semáforojunctions with traffic lights
544
estaciones de Bicing en vivolive bike-share stations

01 — Qué se veWhat you see

Toda la ciudad dibujada como un boceto a tinta sepia, con dos vistas: la ciudad y el subsuelo, con sótanos y las líneas de metro en corte. Al acercarte aparece el detalle: cada edificio con su altura, año y uso, marcas viales, pasos de cebra, semáforos, árboles y coches aparcados.

The whole city drawn as a sepia-ink sketch, with two views: the city and the underground, with basements and the metro lines in cross-section. Zooming in reveals the detail: every building with its height, year and use, road markings, zebra crossings, traffic lights, trees and parked cars.

  • CochesCarsSiguen al de delante, paran en los semáforos en rojo y ceden en los cruces; su número y su ritmo salen del estado real del tráfico.They follow the car ahead, stop at red lights and give way at junctions; how many there are and how fast they go come from the real traffic state.
  • Buses y metroBuses and metroCada expedición, según el horario oficial de TMB.Every trip, following the official TMB timetable.
  • CiclistasCyclistsSalen de las bicis que se cogen y se dejan de verdad en cada estación de Bicing, con una ruta estimada por carril bici.They come from the bikes really taken and returned at each Bicing station, with an estimated route along cycle lanes.
  • PersonasPeopleUna estimación (no hay datos abiertos de peatones): caminan por las aceras, cruzan por las esquinas y esperan al verde; menos de noche y con lluvia.An estimate (there is no open pedestrian data): they walk along the pavements, cross at corners and wait for the green light; fewer at night and in the rain.
  • Tiempo y luzWeather and lightLa altura real del sol, nubes que viajan con el viento, lluvia, niebla, tormenta y casi 100.000 farolas que se encienden al anochecer.The real height of the sun, clouds drifting with the wind, rain, fog, storms and almost 100,000 street lights that switch on at dusk.

02 — Los datosThe data

Todo sale de datos abiertos. Lo estático se procesa una vez en Python; lo vivo lo lee el propio navegador de cada visitante, directamente de su fuente, sin servidor propio.

Everything comes from open data. The static part is processed once in Python; the live part is read by each visitor's own browser, straight from the source, with no server of my own.

DatoDataFuenteSourceRitmoRefresh
Edificios (altura, plantas, año, uso)Buildings (height, floors, year, use)Catastro · INSPIREestáticostatic
Calles, parques, semáforos, monumentosStreets, parks, traffic lights, landmarksOpenStreetMapestáticostatic
Aparcamiento, barrios, arboladoParking, neighbourhoods, treesOpen Data BCNestáticostatic
Horarios de bus y metroBus and metro timetablesTMB · GTFSestáticostatic
Estado del tráfico por tramoTraffic state per road sectionOpen Data BCN5 min
Bicis y anclajes por estaciónBikes and docks per stationBicing · GBFS1 min
TiempoWeatherOpen-Meteo15 min

03 — Cómo está hechoHow it's built

  1. Tubería de datosData pipeline

    320.000 partes de edificio del Catastro se limpian, se generalizan y se agrupan en 70.000 edificios; se cortan en 1.385 teselas de 250 m para el detalle y 127 bloques de 1 km para la vista general. Las calles se convierten en un grafo para los coches y otro para las bicis.

    320,000 building parts from the land registry are cleaned, generalised and merged into 70,000 buildings, then cut into 1,385 tiles of 250 m for detail and 127 blocks of 1 km for the overview. Streets become one graph for cars and another for bikes.

    • GeoPandas
    • Shapely
    • GeoParquet
    • capas bronze · silver · goldbronze · silver · gold layers
  2. Dibujo en el navegadorRendering in the browser

    Shaders propios para el estilo de boceto (contorno a grosor constante, trama solo en las caras en sombra, sombras precalculadas), niveles de detalle, carga en segundo plano y selección de edificios en la GPU. Pensado para ir fluido en un portátil sin tarjeta gráfica y en un móvil.

    Custom shaders for the sketch look (constant-width outlines, hatching only on shaded faces, pre-baked shadows), levels of detail, background loading and building picking on the GPU. Built to run smoothly on a laptop with no graphics card and on a phone.

    • Three.js
    • GLSL
    • Web Workers
  3. SimulaciónSimulation

    Coches con un modelo de seguimiento (IDM) y semáforos de dos fases; buses y metro sobre su horario; ciclistas con rutas A*; personas por las aceras. Todo dibujado con instancias para mover miles de objetos a la vez.

    Cars with a car-following model (IDM) and two-phase traffic lights; buses and metro on their timetable; cyclists with A* routes; people on the pavements. All drawn with instancing to move thousands of objects at once.

    • IDM
    • A*
    • GTFS

04 — Lo que vieneWhat's next

La idea es que la ciudad aprenda de sí misma cada día: guardar el histórico en la nube, detectar lo que no es normal (y buscar qué evento lo explica) y predecir el tráfico y las bicis a 30 minutos con un modelo que se corrige solo con sus aciertos y errores.

The idea is for the city to learn from itself every day: store the history in the cloud, detect what isn't normal (and look for the event that explains it) and predict traffic and bikes 30 minutes ahead with a model that corrects itself from its own hits and misses.