An open source tool for composing transit schedules data in static GTFS standard

319 views
Skip to first unread message

Nikhil VJ

unread,
Apr 24, 2018, 2:50:31 AM4/24/18
to transit-d...@googlegroups.com, open-tr...@lists.okfn.org, buska...@googlegroups.com, pttfgen, making-gtfs-work-for-...@googlegroups.com, kolkata-gtfs-p...@googlegroups.com, kochiopen...@googlegroups.com
Hi Friends,

I have recently worked on a project with WRI (World Resources Institute) and Kochi Metro in Kerala, India (KMRL) to convert their scheduling data to the global standard static GTFS format. 

The first phase of the project was about the data conversion. I wrote a python program that took in KMRL's XML data files and some configuration files, and created a static GTFS feed as output. The fact that the agency itself is fully on board and has dedicated one person on the inside for regular follow-up, has really helped get this project going.

On 17 March this year, Kochi Metro Rail Ltd became India's first transit agency to officially publish static GTFS feed of their system as open data.

See the KMRL open data portal and some news coverage: 1, 2, 3, 4.

See it visualized on a global GTFS feeds map called TRAVIC
(zoom in to kochi and press fast forward. Can adjust time of day.)

Phase 2 of the project aimed higher : we started work on a program with a graphical user interface that would automate several manual processes and help KMRL update their data as the network grows, publish updated feeds on their own without having to rely on any external entity, and very importantly for their case, integrate bus and ferry routes of Kochi in the near future to build towards a unified public transport dataset and facilitate integrated ticketing. As we progressed into this we realised the potential this can have if we generalise it so that any transit agency can use it.

Sharing with you the output of that work so far:




The program runs in the browser (actually, please use Chrome or Chromium and no mobile!) as a website with a server backend created by a Python 3 program. It manages the data in a portable internal database and publishes fresh GTFS feeds whenever wanted.

To play around with a live demo version of the program, see: https://thawing-mountain-46422.herokuapp.com/

Note: If you want to make edits, imports or exports, the password is second paragraph > second line > fifth word of this email. And I won't maintain this instance (made a throwaway one to share with big mailing lists) so go ahead and mess with it at own expense.

Note: while it's compatible to publish this program on a free heroku account, it is currently not designed for multi-user use,  esp for editing/importing where simultaneous sessions can mess things up.

Apart from editing existing GTFS feed, with this it's possible to design a transport system's static GTFS feed from scratch.

---------------------

Invitation for Collaboration

It would be great to get your feedback on this. Inputs from coders, veteran GTFS experts as well as beta testers is most welcome.

Note that this project has started with aiming at simple transit systems, so many sections are simplified to begin with and right now it is oriented for Indian city transit agencies. Especially regarding fare rules, it is targeted at the station pairs model in Example 6 on this explainer wiki.

There is more that can be done with enhancements and integrations, and there are still some limitations that need to be resolved. I'm documenting all I know in the issues section. So I'm reaching out for inviting collaborations on the coding and beta testing front. One motive behind open sourcing is that the community can achieve far more with this project than what any private individual or group can. There's also scope to integrate many other GTFS innovations happening. Please visit the github repo and engage!


Quick links:

--

Cheers,
Nikhil VJ
Pune, India
Email: nikhil.js [at] gmail.com
DataMeet Pune chapter <https://datameet-pune.github.io/>


Sean Barbeau

unread,
Apr 25, 2018, 9:24:00 AM4/25/18
to Transit Developers
Thanks for sharing Nikhil!  I've added this to the awesome-transit GTFS Tools section:

Sean

Paul Harrington

unread,
Apr 25, 2018, 9:59:35 AM4/25/18
to Transit Developers
Hi Nikhil,

This is great however I went looking for the schedule and see you have to sign up. After signing up an email was sent with a link but when I clicked on it I got the message shown in the attached image.

For the schedule to be truly open there should be a public URL which doesn't change and results in the feed being downloaded. It should also of course be kept up to date.

Regards Paul.
kochi.png

Nikhil VJ

unread,
Apr 27, 2018, 2:28:24 PM4/27/18
to Transit Developers
@Sean, thanks!

@Paul, thanks for the heads-up. I've forwarded to the KMRL agency about the error, I hope they resolve it soon. We did discuss about how to provide the download and at this initial stage (as in: no one in India seems to have done this yet at least not officially) they really wanted to know who downloads the data and track and report on how its used, just for proving that the effort is worth it. I hope that over time as it gets normalized they put it as direct download. In any case the GTFS Manager tool comes preloaded with the same data and you can also get a copy in the github repo.

Windows version
I've managed to make a windows standalone version, so the tool can be used in-house by non-coder folks (and that is the target audience anyway: one or more person in a transit agency office). I'll say "managed" because oh boy there were challenges! Looking for feedback about whether it works properly on all windows versions. So far I've only tested on win7 64-bit. You can download the ~30MB zip file from here:

Unzip, go into the folder, and double-click on the "GTFSManager" shortcut. Note that there's a .py file of the same name too so make sure you hit the shortcut.

To run using python or to change the password, pls see the detailed instructions on the project's wiki.

-Nikhil

Nikhil VJ

unread,
May 29, 2018, 12:05:15 PM5/29/18
to Transit Developers
Hi,

Sharing some updates on this project (and inviting inputs on the same):

1. Shoutout to @laidig for making a dockerized version of the program.

2. Shoutout to Dhaval who's working on bus schedules in Ahmedabad, India for pointing out a bug and helping me make the program win10-compatible. (get it here)

3. We're starting work on converting another Indian city's metro system schedule to GTFS format.

4. I have a longer query/thinkaloud about native data formats of signalling systems, which I'll write in a separate post on this group.

5. I'm exploring alternative ways of databasing, with the portability requirement in mind. Looking at HDF5 (.h5) format. 

6. Also exploring "chunking" stop_times and shapes tables that can reduce read/write times and keep memory consumption low.

- Nikhil VJ
Pune, India

Brij Nanda

unread,
May 30, 2018, 12:51:14 PM5/30/18
to transit-d...@googlegroups.com
Thats great work.
I am working on GTFS validation before injecting to google maps for Australia.

--
You received this message because you are subscribed to the Google Groups "Transit Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to transit-developers+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages