GTFS transit feed normalization, analysis, pathfinding and route geometry functions
Compatibility Matrix
This table covers all DuckDB releases that have not reached end-of-life, including LTS releases, and shows the 2 most recent patch releases of each. Older patch releases are not listed, but the extension may be available for them as well.
| Platform | 1.4.4 | 1.4.5 | 1.5.5 | 1.5.6 | 2.0.0 |
|---|---|---|---|---|---|
| Linux AMD64 | |||||
| Linux ARM64 | |||||
| macOS AMD64 | |||||
| macOS ARM64 | |||||
| Windows AMD64 | |||||
| Windows ARM64 | |||||
| WebAssembly |
Installing and Loading
INSTALL gtfs FROM community;
LOAD gtfs;
Example
SELECT route_type_to_name(3);
About gtfs
GTFS DuckDB (gtfs) registers GTFS transit functions at LOAD and exposes explicit dataset lifecycle pragmas: PRAGMA gtfs_prepare, PRAGMA gtfs_init and PRAGMA gtfs_refresh. Loading does not create or reset tables. PRAGMA gtfs_import('feed') reads a GTFS folder and builds every table. Spatial geometry functions need the spatial extension loaded. See https://github.com/gabrielAHN/gtfs-duckdb for the function reference.
Added Functions
| function_name | function_type | description | comment | examples |
|---|---|---|---|---|
| bidirectional_to_direction | macro | NULL | NULL | |
| find_all_paths | table_macro | NULL | NULL | |
| find_reachable_stops | table_macro | NULL | NULL | |
| find_shortest_path | table_macro | NULL | NULL | |
| finish_route_shape_bands | table_macro | NULL | NULL | |
| fit_zoom | macro | NULL | NULL | |
| get_all_pathway_aggregates | table_macro | NULL | NULL | |
| get_all_shapes_map_bounds | table_macro | NULL | NULL | |
| get_calendar_table_data | table_macro | NULL | NULL | |
| get_direct_pathways | table_macro | NULL | NULL | |
| get_direction_types | table_macro | NULL | NULL | |
| get_direction_types_available | table_macro | NULL | NULL | |
| get_from_stops | table_macro | NULL | NULL | |
| get_from_stops_available | table_macro | NULL | NULL | |
| get_gtfs_data_availability | table_macro | NULL | NULL | |
| get_pathway_modes_available | table_macro | NULL | NULL | |
| get_pathway_types | table_macro | NULL | NULL | |
| get_pathways_filtered | table_macro | NULL | NULL | |
| get_reroute_stop_times | table_macro | NULL | NULL | |
| get_route_corridors | table_macro | NULL | NULL | |
| get_route_info | table_macro | NULL | NULL | |
| get_route_map_bounds | table_macro | NULL | NULL | |
| get_route_shapes | table_macro | NULL | NULL | |
| get_route_shapes_for_routes | table_macro | NULL | NULL | |
| get_route_stations | table_macro | NULL | NULL | |
| get_route_stops | table_macro | NULL | NULL | |
| get_route_stops_for_routes | table_macro | NULL | NULL | |
| get_routes_table_data | table_macro | NULL | NULL | |
| get_station_connections | table_macro | NULL | NULL | |
| get_station_info | table_macro | NULL | NULL | |
| get_station_line_bands | table_macro | NULL | NULL | |
| get_station_pathways | table_macro | NULL | NULL | |
| get_station_routes | table_macro | NULL | NULL | |
| get_station_service_routes | table_macro | NULL | NULL | |
| get_station_stops | table_macro | NULL | NULL | |
| get_station_stops_for_pathways | table_macro | NULL | NULL | |
| get_stations_map_bounds | table_macro | NULL | NULL | |
| get_stations_table_data | table_macro | NULL | NULL | |
| get_stop_service_routes | table_macro | NULL | NULL | |
| get_stops_map_bounds | table_macro | NULL | NULL | |
| get_stops_table_data | table_macro | NULL | NULL | |
| get_stops_view_data | table_macro | NULL | NULL | |
| get_time_interval_ranges | table_macro | NULL | NULL | |
| get_time_range | table_macro | NULL | NULL | |
| get_to_stops | table_macro | NULL | NULL | |
| get_to_stops_available | table_macro | NULL | NULL | |
| get_trip_map_bounds | table_macro | NULL | NULL | |
| get_trip_reroute_boundary_pairs | table_macro | NULL | NULL | |
| get_trip_reroute_routes | table_macro | NULL | NULL | |
| get_trip_stops | table_macro | NULL | NULL | |
| get_trips_table_data | table_macro | NULL | NULL | |
| get_trips_time_bounds | table_macro | NULL | NULL | |
| gtfs_add_geometry | pragma | NULL | NULL | |
| gtfs_color_to_hex | macro | NULL | NULL | |
| gtfs_drop | pragma | NULL | NULL | |
| gtfs_empty_calendar | pragma | NULL | NULL | |
| gtfs_empty_calendar_dates | pragma | NULL | NULL | |
| gtfs_empty_pathways | pragma | NULL | NULL | |
| gtfs_empty_routes | pragma | NULL | NULL | |
| gtfs_empty_shapes | pragma | NULL | NULL | |
| gtfs_empty_stop_times | pragma | NULL | NULL | |
| gtfs_empty_trips | pragma | NULL | NULL | |
| gtfs_hex_channel | macro | NULL | NULL | |
| gtfs_hex_to_hue | macro | NULL | NULL | |
| gtfs_import | pragma | NULL | NULL | |
| gtfs_init | pragma | NULL | NULL | |
| gtfs_midi_to_hz | macro | NULL | NULL | |
| gtfs_normalize_calendar | pragma | NULL | NULL | |
| gtfs_normalize_calendar_dates | pragma | NULL | NULL | |
| gtfs_normalize_pathways | pragma | NULL | NULL | |
| gtfs_normalize_routes | pragma | NULL | NULL | |
| gtfs_normalize_shapes | pragma | NULL | NULL | |
| gtfs_normalize_stop_times | pragma | NULL | NULL | |
| gtfs_normalize_stops | pragma | NULL | NULL | |
| gtfs_normalize_trips | pragma | NULL | NULL | |
| gtfs_note_midi | macro | NULL | NULL | |
| gtfs_prepare | pragma | NULL | NULL | |
| gtfs_prepare_route_cache | pragma | NULL | NULL | |
| gtfs_refresh | pragma | NULL | NULL | |
| gtfs_reset_route_cache | pragma | NULL | NULL | |
| gtfs_rgb_hue | macro | NULL | NULL | |
| gtfs_route_cache_version | pragma | NULL | NULL | |
| gtfs_sonify_events | table_macro | NULL | NULL | |
| gtfs_sonify_stops | table_macro | NULL | NULL | |
| gtfs_time_to_seconds | macro | NULL | NULL | |
| location_type_to_name | macro | NULL | NULL | |
| pathway_mode_to_name | macro | NULL | NULL | |
| prepare_route_shape_lanes | table_macro | NULL | NULL | |
| prepare_route_shape_lanes_bus | table_macro | NULL | NULL | |
| prepare_route_shape_lanes_other | table_macro | NULL | NULL | |
| prepare_route_shape_lanes_rail | table_macro | NULL | NULL | |
| refresh_route_shape_bands | table_macro | NULL | NULL | |
| route_band_offset_deg | macro | NULL | NULL | |
| route_type_to_name | macro | NULL | NULL | |
| seconds_to_gtfs_time | macro | NULL | NULL | |
| wheelchair_to_emoji | macro | NULL | NULL |
Overloaded Functions
This extension does not add any function overloads.
Added Types
This extension does not add any types.
Added Settings
| name | description | input_type | scope | aliases | typed_value |
|---|---|---|---|---|---|
| temp_directory | Set the directory to which temporary files are written. | VARCHAR | GLOBAL | [] | post.db.tmp |