1

I have an android application that takes a static GTFS data that I manually turned into a database.

How do I update this GTFS data automatically, or is that not possible?

  • Do you want to update your database representation of the GTFS? Or do you mean you want to take what's in your database and produce a new set of flat files adhering to the spec? Or do you mean that there is now an updated GTFS that has been published and you want to replace the data your application is using? – alphabetasoup Aug 10 '15 at 20:39
2

There is not to my knowledge any ready-made, reusable solution for doing this. However, I can share what I've done in the past.

There are three parts to what you're trying to accomplish:

  1. Automatically detecting and downloading updates to the GTFS feed. A simple approach might be to subscribe (in a feed-reader) to the RSS feed published by GTFS Data Exchange for your agency, which will at least help you know when new data is available so you can manually prepare an update for your app. A completely automatic approach might require the development of a custom tool to poll either the RSS feed or the transit agency's website directly to recognize when new data is available, then download and process it.

  2. Generating a new database from the downloaded data. Here there are some existing resources you can leverage. I myself have written a small utility in C that generates a SQLite database from a GTFS feed; you could perhaps use this as a starting point and modify it to work with your own database schema. If you'd rather stick with Java, the OneBusAway project publishes a number of developer tools you might find useful, including a Java library for working with GTFS data in CSV format.

  3. Deploying the updated database to your users. If your app is designed so it accesses transit data through an API hosted on your own server, this may be as simple as copying over the new database and restarting the app server. If your app instead reads from a database installed on the device itself, pushing updates may be more difficult; I'll have to defer to someone with more experience publishing Android apps in that case.

None of these things is terribly difficult, but it is true that keeping the data used by a transit application up-to-date requires essentially a whole other application itself.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.