This dashboard displays the near real-time position of any bus, tram, or train (ATAC and Roma TPL operators) within the Metropolitan City of Rome Capital. The stream layers automatically updates every 10 seconds through a periodic callback with new data retrieved from the GTFS-RealTime (Overview) feed provided and mantained by Roma Mobilità (website)
Hugging Face: https://huggingface.co/spaces/ivn888/Rome-in-transit
GitHub Pages: https://ivandorte.github.io/Rome-in-transit/gtfs-rt/app.html
Two stream layers (maps):
-
The "Vehicle status" map shows, as the name implies, the current status of the vehicle:
$\textcolor{#0077BB}{\rm \textbf{In\ transit}}$ $\textcolor{#EE7733}{\rm \textbf{Stopped}}$
-
The "Delays map" displays whether a vehicle is on time (ahead + on time) or behind schedule (late)
-
:
$\textcolor{#009988}{\rm \textbf{On\ time}}$ $\textcolor{#CC3311}{\rm \textbf{Late}}$
N.B.: The value of the delay field (in minutes) will be zero if the vehicle is on time (A), negative if ahead of schedule (B) or positive if late (C).
Five number indicators showing:
-
The number of currently active vehicles (fleet) divided between in transit or stopped;
-
The number of vehicles on time or behind schedule;
-
Public transport data from Roma Mobilità;
-
Administrative boundaries from ISTAT (2022);
- Add alerts feed;
- Add routes, stops, etc...;
-
If you view a blank page in HF restart the Space;
-
The periodic callback may suddenly stop working (I don't know why) and the data will not be updated, simply refresh the application page;
- Loaded my custom Python modules from GitHub:
Rome-in-transit/docs/gtfs-rt/app.js
Lines 42 to 52 in 52a790c
-
Loaded protobuf and gtfs-realtime-bindings wheels from a CDN URL:
-
protobuf is available on pypi: https://pypi.org/project/protobuf/#files
-
gtfs-realtime-bindings (https://pypi.org/project/gtfs-realtime-bindings/#files) was compiled via:
python setup.py bdist_wheel
-
-
How I partially solved the CORS problem?
-
Used corsproxy.io to bypass CORS errors on HTTP requests;
-
Used XMLHttpRequest (js) to make HTTP requests of binary data;
-
Rome-in-transit/modules_pyodide/rome_gtfs_rt.py
Lines 51 to 66 in 52a790c
Just read this Medium article written by Sophia Yang, Ph.D.
-
Dashboard logo from Material Symbols - Google
- Ivan D'Ortenzio