# Pemba Traffic GIS 🚗🌍
Pemba Traffic GIS is a modern, high-fidelity monitoring and route-planning platform for the city of Pemba, Mozambique. It leverages advanced GIS technologies, real-time simulation, and a premium interactive interface.
## 🚀 Key Features
- **Dynamic Traffic Intelligence**: Real-time road congestion analysis based on actual simulated vehicle density (Optimal vs Moderate vs Congested).
- **Proactive GIS Routing**: K-shortest paths calculation using projected coordinate systems (UTM) for high metric precision. Includes support for **Current User Location** (GPS).
- **Smart Monitoring UI**: Premium dark-mode interface with glassmorphism, featuring smooth vehicle movement animations and telemetry popups.
- **Polygonal Geofencing & Security**: Draw custom, dynamic geofence zones directly on the map. Automated monitoring of vehicle displacement with visual and notification alerts for unauthorized exits from safe zones.
- **Analytics Dashboard**: Live KPIs, fleet average speeds, congestion charts, and alerting metrics in real-time.
- **Interactive Map Layers**: Dynamic heatmap of traffic flow and road color-coding based on real-time occupancy.
- **Fault-Tolerant Real-Time Streaming**: WebSockets with auto-reconnect logic for robust, low-latency telemetry and traffic updates.
## 🛠️ Technology Stack
- **Backend**: FastAPI, Python 3.11, OSMnx, NetworkX, Shapely, GeoAlchemy2, PyProj.
- **Frontend**: React (Vite), Leaflet, react-leaflet-draw, Framer Motion (for animations), Recharts.
- **Database**: PostgreSQL + PostGIS (Trajectory history and spatial analysis).
## 📦 Quick Start with Docker
Ensure you have Docker and Docker Compose installed.
```bash
docker compose up -d --build
```
Access the system:
- **Frontend App**:
- **Backend API Docs**:
- **Spatial Viewer (Adminer)**: (Connect to `postgis:5432`)
## 🖥️ Running Backend Natively (Without Docker)
If Docker Desktop runs out of memory on your machine, run the backend natively:
1. Ensure the da …