GTFS+¶
Entity types for GTFS+, the extension set used by the Metropolitan Transportation Commission and the Bay Area agencies that report to it. GTFS+ adds files the base specification does not define: direction names, timing points, rider categories, and the identifier tables that tie a realtime feed to the static schedule.
If your feed contains files like directions.txt or rider_categories.txt and the
importer is skipping them, this is the module that gives them somewhere to go.
Files covered¶
Each file becomes a bundle of the gtfs_row entity type, the same as the standard GTFS
files, so everything that already works against GTFS rows works against these too.
| File | What it holds |
|---|---|
directions |
Human-readable direction names per route, keyed by route_id and direction_id |
timepoints |
Which stops on a trip are published timing points |
stop_attributes |
Extra descriptive fields for stops |
farezone_attributes |
Fare zone names |
calendar_attributes |
Service descriptions for calendars |
realtime_routes |
Maps realtime route identifiers to static route_id |
realtime_stops |
Maps realtime stop identifiers to static stop_id |
realtime_trips |
Maps realtime trip identifiers to static trip_id |
The fare files — rider_categories and fare_rider_categories — come from GTFS
Utilities' GTFS Fares submodule, which is why this module depends on it.
Requirements¶
- GTFS Core 3.x
- Its GTFS Fares submodule, enabled
Installation¶
composer require drupal/gtfs_plus
Enable the module, then re-import your feed. The importer picks up the new files on the next import; it does not backfill an import that already ran.
Usage¶
There is no configuration. Enabling the module registers the file definitions, and the
rows appear alongside the standard GTFS entities under Administration › GTFS. Directions,
for example, are at /admin/gtfs/directions.
The REST API exposes directions per route and per stop:
/gtfs/api/v2/feeds/{feed}/agencies/{agency}/routes/{route}/directions
/gtfs/api/v2/feeds/{feed}/stops/{stop}/directions
Both return an empty result rather than an error when this module is not installed, so a client can call them unconditionally.
Extending¶
The files are declared with the #[GTFSFile] attribute, the same mechanism GTFS Core
uses for the standard files. To add a file of your own, or to change the fields on one of
these, declare a class extending Drupal\gtfs\Entity\GTFSRow with that attribute. See
gtfs.api.php in GTFS Core for the hooks available around import and field
definitions.
Issues¶
File issues and merge requests at https://www.drupal.org/project/issues/gtfs_plus.
Related modules¶
- GTFS Core — the entities, the importer and the API everything else reads
- GTFS Realtime — trip updates, vehicle positions and service alerts
- 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
Maintainers¶
This project has been sponsored by: