BVG-Bus Tracker
Nov 13, 2025
Β·
1 min read
Real-time Bus Tracking Map (Leaflet + BVG API)
This project is a lightweight, mobile-friendly web page that displays real-time locations of selected bus lines using the BVG / VBB transport.rest API and Leaflet maps.
The page works on both desktop and mobile browsers and automatically updates vehicle positions every few seconds.
β¨ Features
- β‘ Live bus position tracking
- π― Customizable geographic radius (default: 3 km)
- π Supports multiple bus lines (e.g., 142 & 123)
- β‘οΈ Direction arrows that rotate to indicate vehicle movement
- π¨ Color-coded arrows based on destination (e.g., red vs. green)
- π Fixed reference markers (e.g., blue point)
- π± Fully responsive layout for both phones and desktops
- βΉοΈ Vehicle popup shows:
- Direction
- Next stop (
nextStopovers[2]) - Planned arrival time
- Delay information
π Technology Stack
- Leaflet.js for map visualization
- OpenStreetMap tiles
- transport.rest (BVG/VBB) real-time
radarendpoint - Vanilla HTML + JavaScript
- No backend required
π Data Source
Powered by transport.rest
API documentation: https://v6.transport.rest/
π Notes
- Some mobile browsers block remote script loading from
file://
β Use GitHub Pages or any HTTP server to view the map properly. - The bus lines and radius can be easily changed in the JavaScript section.