GTFS Realtime
This module ingests GTFS Realtime feeds for trip updates, vehicle positions, and service alerts, making the data available as JSON. It also provides REST endpoints to query predicted arrivals, vehicle locations, and active alerts.
Ingests GTFS Realtime feeds — trip updates, vehicle positions and service alerts — and serves them as JSON alongside the static schedule data from
GTFS Core.
Each feed is a configuration entity, so feeds deploy with your configuration instead of being clicked in by hand on every environment.
Features
- Protobuf ingestion for all three GTFS-RT feed types, decoded and cached as JSON.
- A refresh interval per feed, 60 seconds by default, run from cron.
- An out-of-band refresh endpoint, so a display that asks for stale data can trigger its own update rather than waiting for the next cron run.
- REST endpoints for predicted arrivals at a stop, vehicles on a route, and active alerts. Realtime responses are marked uncacheable by clients, so a CDN in front of the site cannot serve yesterday's predictions.
- Hooks for feeds whose realtime identifiers differ from the static ones.
Requirements
GTFS Core 3.x. The lowa/gtfs-realtime-php library is installed by Composer.
Installation
composer require drupal/gtfs_rt
Configuration
Add feeds at Administration › GTFS › Realtime feeds (/admin/gtfs/rt/feeds). Each needs a type, the protobuf endpoint URL, and a refresh interval. For public kiosk use, grant the restful get gtfs_rt_* permissions to the anonymous role.
When realtime IDs do not match the schedule
Regional aggregators often key stops differently from the agency's own static feed — a prefixed stop code, a different agency namespace. Rather than rewriting imported data, implement the identifier hooks in your own agency module. The mapping then lives with the agency, and survives the next feed import.
Rest API
Browse the REST API in OpenAPI format here.
Related modules
- GTFS Core — the entities, the importer and the API everything else reads
- GTFS Display — stop, route and system displays for public screens
- GTFS Display Map — route and stop geometry on a map
- GTFS Display Map RT — live vehicles, and an embeddable map
- GTFS Schedule — readable timetables
- GTFS 511 — feed provisioning from the 511 SF Bay API
- GTFS+ — the GTFS+ extension files
Maintainers
Maintained by tbcs and jpsalter, supported by FivePaths. These modules run public transit information systems in daily service. Issues and merge requests are welcome, and so are co-maintainers.