GTFS-RT Vehicle positions
STIB: brussels metro, tram and bus operator
- Format
- GTFS-RT
- Updates
- On request, from the latest vehicle-trip snapshot (every 20 seconds)
curl -H "Authorization: Bearer $MOBILITYTWIN_TOKEN" -o gtfs-rt-vehicle-position.pb "https://api.mobilitytwin.brussels/stib/gtfs-rt-vehicle-position"
STIB/MIVB vehicle positions as a standard GTFS Realtime feed, built from vehicle-trip. Produced by MobilityTwin.Brussels, not an official STIB feed.
One VehiclePosition per vehicle, with trip_id, start_date and start_time where the trip was established, and otherwise only route_id and direction_id. vehicle.id is the tracking uuid, stable for one run. IDs match the gtfs endpoint of the same day.
A binary GTFS Realtime message (Protocol Buffers). Decode it with gtfs-realtime-bindings.
Parameters
| Name | Meaning |
|---|---|
start_timestamp | Start of the range, in Unix seconds or ISO 8601. Without any timestamp, the last hour is used; with only one, the hour starting or ending at it. |
end_timestamp | End of the range, in Unix seconds or ISO 8601. |
Python example
import requests
from google.transit import gtfs_realtime_pb2
url = "https://api.mobilitytwin.brussels/stib/gtfs-rt-vehicle-position"
data = requests.get(url, headers={
'Authorization': 'Bearer [MY_API_KEY]'
}).content
feed = gtfs_realtime_pb2.FeedMessage()
feed.ParseFromString(data)
# List all vehicle positions (trip_id is empty for a vehicle not yet matched)
for entity in feed.entity:
v = entity.vehicle
print(f"Route {v.trip.route_id} trip {v.trip.trip_id or '-'}: "
f"({v.position.latitude:.4f}, {v.position.longitude:.4f}), "
f"stop {v.stop_id or '-'} seq {v.current_stop_sequence}")