A Data-Driven Intelligent Traffic Routing System for Kampala City, Uganda, Towards Smart Urban Mobility
Discuss this preprint
Start a discussion What are Sciety discussions?Listed in
This article is not in any list yet, why not save it to one of your lists.Abstract
Urban traffic congestion remains a major challenge in rapidly growing cities, especially across sub-Saharan Africa, where infrastructure development often lags behind population growth and vehicle demand. This study presents a machine learning-based framework for real-time route optimization designed for Kampala City, Uganda. The system utilizes the Google Routes API to generate multiple alternative routes between origin and destination points and applies a congestion scoring scheme based on traffic flow categories. A labeled dataset was used to train a Random Forest Classifier, incorporating temporal features such as the day of the week and time of day to predict the least congested routes. The model achieved high predictive accuracy and effectively classified congestion levels under varying traffic conditions. To ensure practical usability, the trained model was integrated into a Node.js-based backend connected to a MySQL database, facilitating real-time route recommendations via a geo-location-enabled interface. The findings demonstrate that integrating machine learning with dynamic traffic data can significantly enhance urban mobility management. Overall, the proposed system provides a scalable, data-driven, and context-aware solution for intelligent traffic routing, with strong potential for adaptation in other rapidly urbanizing cities across East Africa.: Traffic congestion is a critical challenge in rapidly urbanizing cities across sub-Saharan Africa, as infrastructure development often fails to keep pace with increasing populations and vehicle demand. In Kampala City, Uganda, commuters face severe travel delays, increased fuel consumption, and productivity losses, resulting in substantial economic and environmental costs. Existing traffic management systems lack real-time predictive capabilities, limiting informed route planning. This study presents a data-driven intelligent traffic routing system that integrates machine learning with real-time geospatial data to optimize mobility in Kampala. A Random Forest Classifier (RFC) was trained on features from the Google Maps Directions API, including travel time, distance, time of day, and day of the week, to predict congestion levels and recommend the least congested routes. The model was deployed through a Node.js backend and a geo-enabled web interface, enabling real-time route generation. Experimental results show that the RFC achieved a classification accuracy of 92%, outperforming baseline time-series models. Comparative evaluation with live traffic data confirmed the system’s accuracy, scalability, and adaptability. The study demonstrates the potential of machine learning and geospatial analytics to enhance smart mobility in resource-constrained environments, offering a practical framework for policymakers to advance AI-driven urban transportation systems in Kampala and similar African cities.