List of GTFS feeds loaded in the system
List of entities imported by the module
List of file types managed by the module
List of routes, as an example of data managed by the system
Route edit screen, showing data captured by the module

Visit GTFS.media for an overview of this suite of modules.

GTFS Utilities turns a GTFS feed into Drupal entities. Point it at a feed URL and import: every file in the specification — agency, routes, trips, stops, stop_times, calendar, shapes and the rest — becomes queryable, translatable, referenceable content, with a read-only REST API in front of it.

It is the base of a family of modules for running transit information on Drupal. Realtime predictions, on-screen displays, maps and timetables all build on the entities this module creates.

Features

  • An entity type per GTFS file, with fields mapped and relationships resolved between them.
  • Several feeds on one site, each namespaced by a URL-safe alias, so a single install can serve more than one agency.
  • Import from a remote zip, with an audit of what changed between one import and the next.
  • A REST API under /gtfs/api/v2/feeds/{alias}/ covering agencies, routes, stops, trips and schedules.
  • Drush commands for scripted refreshes: gtfs:feed:refresh and gtfs:feed:audit.
  • Token support for GTFS rows, so feed data is available anywhere tokens are.
  • Per-file plugin definitions, so a feed carrying files outside the specification can be handled without patching the module.
  • An optional GTFS Fares submodule covering fare_attributes, fare_rules, fare_products, fare_media, rider_categories, and the fare leg and transfer rules.

Requirements

Drupal 10.3 or 11, plus Timezone Field, Time Field and Entity Reference Revisions. The GTFS Fares submodule also needs Currency Field.

Installation

composer require drupal/gtfs, then enable the module. See Installing modules for the longer version.

Configuration

Add a feed at Administration › GTFS › Feeds (/admin/gtfs/feed): give it a name, an alias, and the URL of the feed zip. Import from the feed's own page. Imported entities are then browsable under Administration › GTFS, and the file-to-entity mapping is at /admin/structure/gtfs/filenames. GTFS entities are entirely fieldable, revisionable, and translatable and hook into the entity system in every regular way.

REST API

Browse the REST API in OpenAPI format here.

Extending

Agencies whose service calendars follow local holidays can supply their own holiday provider through hook_gtfs_yasumi_provider_alter(). Feed files outside the specification can be added as GTFS file plugins rather than forked into the module. The included gtfs_fares module offers a canonical way to do this.

Upgrading from 2.x

3.x is a rewrite. Feeds gained aliases, the API moved to /gtfs/api/v2/, and the entity storage changed. Re-import rather than migrating in place, and read the release notes before upgrading a production site.

Related modules

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.

Supporting organizations: 

Project information

Releases