Skip to content

Kotlin library for handling GTFS files

License

Notifications You must be signed in to change notification settings

mjaakko/gtfs-library

Repository files navigation

gtfs-library Run tests and build project

Kotlin library for handling GTFS files, with focus on Java interoperability. Requires Java 11+. Supports both parsing and writing GTFS files.

Documentation for latest version is available here.

Features

  • Parsing GTFS data from ZIP archives and uncompressed CSV files
  • Writing GTFS data to ZIP archives and uncompressed CSV files
  • Data classes for GTFS data types
    • Properties use corresponding Java types when it makes sense (e.g. LocalDate for dates)
  • Utilities for handling GTFS date and time values

Usage

gtfs-library is published as a Maven artifact through GitHub packages. See package page for latest version.

Note: GitHub Packages registry must be configured to use the package. See GitHub's documentation for Maven and Gradle for more details.

Examples

  • Print all stop IDs and names:
val gtfsParser = ZipGtfsFeedParser(Paths.get("gtfs.zip"))

val stops = gtfsParser.parseStops().toList()
stops.forEach { stop ->
  println("${stop.stopId} - ${stop.stopName}")
}

gtfsParser.close()