Skip to content

Java GTFS-realtime Language Bindings

Maven Central Version

Provides Java classes generated from the GTFS-realtime Protocol Buffer specification. These classes will allow you to parse a binary Protocol Buffer GTFS-realtime data feed into Java objects.

Add the Dependency

To use the gtfs-realtime-bindings classes in your own project, you need to add an appropriate dependency. We publish our module to the Maven Central Repository so that it can be easily referenced by Java build tools like Maven, Ivy, and Gradle.

For Maven, add the following to your pom.xml dependencies section:


For Gradle, add the following to your build.gradle dependecies section:

compile group: 'org.mobilitydata', name: 'gtfs-realtime-bindings', version: '0.0.8-SNAPSHOT'

Make sure the Maven central repository is referenced by your project.

Example Code

The following code snippet demonstrates downloading a GTFS-realtime data feed from a particular URL, parsing it as a FeedMessage (the root type of the GTFS-realtime schema), and iterating over the results.



public class GtfsRealtimeExample {
  public static void main(String[] args) throws Exception {
    FeedMessage feed = FeedMessage.parseFrom(url.openStream());
    for (FeedEntity entity : feed.getEntityList()) {
      if (entity.hasTripUpdate()) {

For more details on the naming conventions for the Java classes generated from the gtfs-realtime.proto, check out the Java Generated Code section of the Protocol Buffers developer site.

Project History

0.0.4 and lower

This project was originally created by Google. You can download versions 0.0.4 and older under the Group ID here on Maven Central.


MobilityData started to maintain the project in early 2019 and initially published release artifacts via JCenter. You can download version 0.0.5 under the Group ID io.mobilitydata.transit here on Maven Central.

0.0.6 and 0.0.7

JCenter shut down in 2021. Prior to the shutdown, a synchronization problem prevented versions 0.0.6 and 0.0.7 from being synchronized from JCenter to Maven Central, so direct artifact download is not currently available for these versions. However, you can compile them yourself from the tags using the command mvn package.

0.0.8 and higher

In 2022, MobilityData switched to publishing artifacts directly to Maven Central under the Group ID org.mobilitydata, which is where versions 0.0.8 and higher are published.

Back to top