Skip to content

wheelstransit/GTFS-Dense

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GTFS-Dense (.gtfsd)

License: MIT Spec Version

GTFS-Dense is a fast, binary serialization format for static public transit data (GTFS).

The goal of GTFS-Dense is to enable quick, offline loading of an entire GTFS network on memory-constrained devices like mobile phones and web browsers, eliminating the need to parse large text files.

GTFS-Dense uses Protocol Buffers (PBF) as its underlying encoding format. A converter tool reads a standard GTFS feed, resolves all relational links (e.g., connecting a trip to its stop times and shape), and writes the data into a nested, graph-like structure.

Structure

  • proto/ - The Protocol Buffers schema.
  • src/gtfsdense/ - The main Python package.
    • converter.py - The script to convert GTFS to GTFS-Dense.
    • gtfs_dense_pb2.py - The generated Python code from the schema.
  • gtfs-dense-rust/ - The Rust library for parsing GTFS-Dense.
  • pyproject.toml - The Python project definition file.

Usage

To convert a GTFS .zip file to a .gtfsd file, use the converter script:

python -m src.gtfsdense.converter --input /path/to/your/gtfs.zip --output /path/to/your/output.gtfsd

Development

This project uses setuptools for packaging and protoc for generating the protobuf code.

Python

  1. Install dependencies:

    pip install -e .
  2. Modify the schema:

    Edit proto/gtfs-dense.proto.

  3. Regenerate the protobuf code:

    protoc --python_out=src --proto_path=proto proto/gtfs-dense.proto

Rust

  1. Build the library:

    cd gtfs-dense-rust
    cargo build
  2. Run the example:

    cargo run --example print_feed -- <path/to/your.gtfsd>

About

GTFS but in 1 file

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published