Fauzan Abdullah


Session

09-02
14:30
30min
Open-Source Spatiotemporal Traffic Congestion Analysis at City Scale: A Reproducible Python Pipeline Combining PySAL, OSMnx, and Multilevel Modeling
Firman Hadi, Fauzan Abdullah

Urban traffic congestion costs Southeast Asian economies 2–5% of GDP annually, yet the analytical methods needed to disentangle its spatial and temporal drivers—exploratory spatial statistics, network topology analysis, multilevel variance decomposition—have traditionally required proprietary GIS platforms whose licensing fees are prohibitive for the developing-country cities that need them most. This extended abstract presents traffic-congestion-pipeline, an open-source Python package (v0.4.0, MIT license, pip install traffic-congestion-pipeline) that delivers a complete, reproducible workflow for large-scale spatiotemporal traffic research using exclusively FOSS4G tools. The package, its source code, and full API documentation are publicly available at https://github.com/firmanhadi21/traffic-analyses and https://firmanhadi21.github.io/traffic-analyses/.

The pipeline integrates five mature open-source components into a unified eleven-command CLI and Python API. (1) PySAL's esda and libpysal compute Global Moran's I and Local Indicators of Spatial Association (LISA) with K-nearest-neighbor spatial weights for hotspot detection. (2) PySAL's giddy module fits classic Markov and Spatial Markov transition models to quantify how congestion hotspots persist over time and whether their transitions depend on neighboring segments' states (spatial contagion). (3) OSMnx downloads street network graphs and computes betweenness centrality and graph-based capacity-drop detection, linking network topology to congestion. (4) statsmodels.mixedlm fits nested mixed-effects models—null, temporal, and full—that rigorously partition within-segment (temporal) and between-segment (spatial) variance using absolute speed (km/h) rather than the normalized jam factor, avoiding circularity from free-flow speed normalization. (5) Uber H3 hexagonal aggregation re-runs spatial autocorrelation tests at multiple resolutions (6–9) to check robustness against the modifiable areal unit problem (MAUP). Each component maps to a dedicated CLI command (traffic-pipeline multilevel, markov, speed-validation, h3-robustness, etc.), allowing researchers to execute any stage independently or chain the full workflow from automated data collection to publication-ready figures.

We apply this pipeline to over 264 million traffic observations collected at 15-minute intervals from the HERE Traffic API across three Indonesian cities over 11 months (March 2025–February 2026): Jakarta (14,549 road segments, population 10.5 million), Bandung (3,069 segments, 2.5 million), and Semarang (1,076 segments, 1.8 million). These cities span a 20× population range and feature high motorcycle mode shares, representing traffic dynamics markedly different from car-dominated Western cities.

Multilevel variance decomposition shows that 88–89% of total speed variance lies between segments (ICC), reflecting road design differences. Within segments, time-of-day explains 57–67% of speed fluctuations, while betweenness centrality adds less than 1% explanatory power beyond road type. ANOVA across four speed metrics confirms this temporal dominance is not a normalization artifact: η² = 8–10% for jam factor and speed reduction, 5–6% for absolute speed, and effectively zero for free-flow speed. Centrality correlations with absolute current speed are near zero (R² < 0.003); moderate centrality–jam factor correlations (R² = 0.06–0.14) are mediated entirely through free-flow speed. Evening peak congestion exceeds daily averages by approximately 40% across all three cities.

Global Moran's I is non-significant for all cities (p > 0.35). LISA identifies local clusters in ~10% of segments along known corridors, though none survive FDR correction. LISA Markov analysis reveals an inverse relationship between city size and hotspot persistence: Semarang retains hotspots at 18.8% probability versus Jakarta's 6.5%, yet no segment persists across all eight daily periods. Spatial Markov testing detects significant contagion in Bandung (χ² = 8.43, p = 0.004) and Semarang (χ² = 6.48, p = 0.011), but not in Jakarta, where denser network topology dissipates spillovers. H3 robustness analysis confirms null spatial autocorrelation at neighbourhood scales for Bandung and Semarang, while revealing a weak signal for Jakarta at resolution 8 (I = 0.030, p = 0.033).

This work is relevant to the FOSS4G community for four reasons. First, it demonstrates that PySAL, OSMnx, statsmodels, and H3—all open-source—can handle a dataset of 264 million observations end-to-end in approximately 15 minutes on consumer hardware (Mac Mini M2 Pro), establishing that FOSS4G tools are ready for operational, city-scale traffic analysis, not just prototyping. Second, the pipeline is released as a versioned, installable PyPI package with eleven CLI commands and comprehensive documentation, lowering the barrier for adoption by transportation agencies in resource-constrained settings where proprietary licenses are unaffordable. Third, the modular, command-per-analysis architecture provides a reusable template for applying FOSS4G tools to other urban analytics domains—air quality, land use change, public health surveillance—extending the impact beyond traffic. Fourth, the substantive finding—that congestion is primarily a demand synchronization problem rather than a spatial infrastructure constraint—carries direct policy implications for cities investing in road expansion versus demand management, and was only discoverable through the multi-method integration that Python's composable ecosystem uniquely enables.

The convergence of four independent spatial tests on null results for absolute speed, validated through MAUP-robust H3 aggregation, provides a level of methodological rigor that strengthens confidence in this conclusion. We believe this combination of open-source tooling, reproducible packaging, large-scale empirical validation, and policy-relevant findings makes a strong case for presentation at the FOSS4G Academic Track, and we look forward to engaging with the community on extending the pipeline to cities beyond Indonesia.

Keywords: open-source, reproducibility, PySAL, OSMnx, traffic congestion, FOSS4G

Academic Track
Cosmos2