knitr::opts_chunk$set(collapse = TRUE, comment = "#>")
read_gtfs(), as_wizardgtfs(), and create_gtfs() check package
requirements when constructing a feed. For a broader, independent report
against the GTFS Schedule specification and best practices, validate_gtfs()
runs the MobilityData Canonical GTFS Schedule Validator.
The validator is external to GTFSwizard; its results depend on its version
and implemented rules. No reported errors is not a certification.
read_gtfs(path, repair = "none") checks the input without legacy reference
cleanup. The default records reference repairs in repair_report(). Use
repair_gtfs() on the original tables to explicitly request time corrections.
feed <- GTFSwizard::for_rail_gtfs fixed <- GTFSwizard::repair_gtfs(feed, repairs = "overnight") head(GTFSwizard::repair_report(fixed))
The report identifies the original row and the old and new values. Overnight
repair corrects backward jumps greater than 12 hours. The optional "stop_times"
repair interpolates intermediate calls between known times.
Install Java 17 or newer and the optional R package jsonlite. To let
GTFSwizard download the official version 8.0.1 CLI JAR, also install openssl
and request the download explicitly. The first download is about 38 MB and
requires internet access. The JAR is stored in the user cache, outside the R
package, and its SHA-256 is checked before each use. Subsequent calls with
download_validator = TRUE reuse the verified cached file.
install.packages(c("jsonlite", "openssl")) library(GTFSwizard) result <- validate_gtfs("path/to/feed.zip", download_validator = TRUE)
Alternatively, supply an existing compatible validator CLI JAR. A JAR path
supplied explicitly or in GTFS_VALIDATOR_JAR takes precedence over the
download option. The JAR must support --skip_validator_update.
result <- validate_gtfs("path/to/feed.zip", validator_jar = "path/to/validator.jar") # Or configure the path once per session: Sys.setenv(GTFS_VALIDATOR_JAR = "path/to/validator.jar") result <- validate_gtfs("path/to/feed.zip")
The function prints a summary even when the result is assigned. notices
contains codes, severities, counts, and samples; system_notices describes
validator execution problems. has_errors is TRUE if GTFS errors are found,
FALSE if validation completes without errors, and NA when execution is
incomplete or the result cannot be interpreted reliably. quiet = TRUE
suppresses the printed summary.
result$has_errors result$notices result$system_notices
By default, reports are temporary and removed after the result is read into R. To keep the full HTML and JSON reports, supply an empty or new directory:
result <- validate_gtfs("path/to/feed.zip", download_validator = TRUE, output_dir = "validation-report") result$html_path result$report_path
Pass an original ZIP to inspect it before package import or repair. A named feed object can also be supplied, but it is first exported to a temporary ZIP; the report then describes the exported representation, not the original file. This is useful for checking a scenario before publication. No feed is uploaded by GTFSwizard.
scenario <- delay_trip(for_rail_gtfs, trip = for_rail_gtfs$trips$trip_id[1], duration = 60) result <- validate_gtfs(scenario, download_validator = TRUE)
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.