GTFS - General Transit Feed Specification

Added in version 3.7.

Driver short name

GTFS

Driver built-in by default

This driver is built-in by default

This driver can read a .zip archive containing text files following the GTFS specification.

The driver presents layers with their original structure, and:

  • enhances the stops layer with Point geometries

  • enhances the trips layer with LineString geometries reconstructed by joining the trips layer with stops and stop_times layers

  • expose a shapes_geom layer, if the optional shapes is present by constructing LineString geometries.

Open syntax

The connection name can be:

  • a .zip filename containing GTFS .txt files

  • a directory name prefixed with GTFS: (potentially a /vsizip/path/to/the.zip filename prefixed with GTFS:)

Alternatively, starting with GDAL 3.10, specifying the -if GTFS option to command line utilities accepting it, or GTFS as the only value of the papszAllowedDrivers of GDALOpenEx(), also forces the driver to recognize the passed filename.

Driver capabilities

Supports VirtualIO

This driver supports virtual I/O operations (/vsimem/, etc.)

Examples

List the contents of a GTFS local zip file:

Bash

ogrinfo GTFS_Realtime.zip

gdal CLI

gdal vector info GTFS_Realtime.zip

List the contents of a GTFS local directory:

Bash

# specifying the driver
ogrinfo GTFS:"/data/GTFS_Realtime"
# specifying the input format
ogrinfo /data/GTFS_Realtime -if GTFS

gdal CLI

# specifying the driver
gdal vector info GTFS:"/data/GTFS_Realtime"
# specifying the input format
gdal vector info /data/GTFS_Realtime --input-format GTFS

List the contents of a GTFS file at a URL:

Bash

ogrinfo /vsicurl/https://www.transportforireland.ie/transitData/Data/GTFS_Realtime.zip

gdal CLI

gdal vector info /vsicurl/https://www.transportforireland.ie/transitData/Data/GTFS_Realtime.zip

Extract the stops from the GTFS file and save into a FlatGeobuf file:

Bash

ogr2ogr stops.fgb GTFS_Realtime.zip stops

gdal CLI

gdal vector convert GTFS_Realtime.zip stops.fgb --input-layer stops