A GTFS Schedule (static) General Transit Feed Specification (GTFS) feed validator
This README contains information for the master branch of this project, which is under active development. If you'd like to view documentation for past releases of the project, see:
This is a command-line tool written in Java that performs the following steps:
- Loads input GTFS zip file from a URL or disk
- Checks file integrity, numeric type parsing and ranges as well as string format according to the GTFS Schedule specification
- Performs GTFS business rule validation
- Install Java 11 or higher. To check which version of Java is installed on your computer, type the following command in the terminal:
java --version
. - Download the latest snapshot jar of the validator from the artifacts generated by the
Test Package Document
workflow. See detailed instructions here. - Open the terminal on your computer
- Navigate to the directory containing the jar file. You can do this by typing the following command in the terminal:
cd {directory path}
, where {directory path} is the absolute or relative path to the directory. You can then make sure you're in the right directory by typingpwd
in the terminal (this stands for present working directory). You can also make sure the jar file is there by typingls
in the terminal (this stands for list and will display the list of files in this directory). More about commands to navigate file and directories here.
You can run this validator using a GTFS dataset on your computer, or from a URL.
-
To validate a GTFS dataset on your computer, run the following command in the terminal, replacing the text in brackets:
java -jar {name of the jar file} -i {path to the GTFS file} -o {name of the output directory that will be created}
- here is an example of what the command could look like:
java -jar gtfs-validator-v-snapshot_cli.jar -i /myDirectory/gtfs.zip -o output
-
To validate a GTFS dataset from a URL, run the following command in the terminal, replacing the text in brackets:
java -jar {name of the jar file} -u {URL to the GTFS file} -o {name of the output directory that will be created}
- here is an example of what the command could look like:
java -jar gtfs-validator-v-snapshot_cli.jar -u https://www.abc.com/gtfs.zip -o output
More detailed instructions with all the parameters that exists are available on our "Usage" page.
- Download and install Docker
- Pull the latest Docker image for this project. For example,
docker pull ghcr.io/mobilitydata/gtfs-validator
for the latest snapshot version of the validator.
To run the Docker image in a new container:
docker run -v /myDirectory:/theContainerDirectory -it ghcr.io/mobilitydata/gtfs-validator:latest
where:
-v /myDirectory:/theContainerDirectory
: syntax to share directories and data between the container and the host (your computer). With the above command, any files that you place in/myDirectory
on the host will show up in/theContainerDirectory
inside the container and vice versa.
NOTE: On Windows, you must provide the local volume (e.g., c:
) as well:
... c:/myDirectory:/theContainerDirectory ...
The validator can then be executed via bash commands. See the preceeding instructions for command line usage.
Possible future rules for:
Have a suggestion for a new rule? Open an issue. You can see the complete process for adding new rules on the "Adding new rules" page.
We suggest using IntelliJ to import, build, and run this project.
Instructions to build the project from the command-line using Gradle are available in our Build documentation.
The architecture of the gtfs-validator
is described on our Architecture page.
In order to avoid sudden changes in the validation output that might declare previously valid datasets invalid, all code changes in pull requests are tested against GTFS datasets in the MobilityDatabase. The acceptance test process is described in ACCEPTANCE_TESTS.md.
Code licensed under the Apache 2.0 License.
We welcome contributions to the project! Please check out our Contribution guidelines for details.