teraffic is a Python prototype for route planning under convoy movement constraints in dense city traffic.
The current implementation works in three steps:
- Download the drivable road network for Mumbai from OpenStreetMap.
- Compute a shortest main route between fixed start and end coordinates.
- Identify feeder paths that connect into that main route and render everything on an interactive map.
This repository is not a production traffic control system yet. It is a research-style simulation workflow you can run locally.
- Stage: prototype / research workflow
- What works now: network download, route computation, feeder extraction, map output
- What is hardcoded: city (
Mumbai, India) and example coordinates insrc/downm.pyandsrc/jsonroute.py - What is missing for production: live signal control logic, APIs, tests, packaging, and deployment automation
teraffic/
├── src/
│ ├── downm.py # downloads OSM road graph and saves GraphML
│ ├── jsonroute.py # computes main route + feeder paths, writes JSON
│ └── visu.py # renders map layers to HTML
├── requirements.txt
└── README.md
- Python 3.10+
- pip
- Internet access (required for OpenStreetMap download in
downm.py)
python -m venv .venvWindows:
.venv\Scripts\activateLinux/macOS:
source .venv/bin/activateInstall dependencies:
pip install -r requirements.txtCreate output folders (ignored by git):
mkdir downloads
mkdir visualFrom the teraffic root:
- Download city road network:
python src/downm.py- Compute route and feeder paths:
python src/jsonroute.py- Generate the visualization:
python src/visu.pyExpected outputs:
downloads/mumbai_drive_network.graphmlsrc/feeder_route_data.jsonvisual/mumbai_road_network_with_feeder_routes.html
Open the HTML file in a browser to inspect the result.
To try another scenario, edit:
place_nameinsrc/downm.pystart_coordsandend_coordsinsrc/jsonroute.py
- No command-line arguments or config file yet.
- No validation for impossible routes or missing files.
- Route quality is based on road length only (
weight='length'). - No automated test coverage at the moment.
- Add CLI arguments for city and coordinates.
- Add route quality options (time, congestion proxy, blocked intersections).
- Add unit tests for feeder path extraction.
- Wrap the workflow in a small API service for integration with other tools.