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 radar endpoint
  • 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.