Tuesday, September 27, 2011

Data model diagrams for GTFS

Recently I've been doing some work with the General Transit Feed Specification (GTFS).  This is a simple data model initiated by Google, in order to allow transit organizations to publish their schedules for routing and visualization purposes.

As usual, Google has nice, succinct documentation for the GTFS format (which is a set of CSV files embodying an implicit data model).  But I was surprised to find that they don't provide any kind of data model diagram showing the relationships between the various entities (files) in the model.  I have a feeling that they think this would be "too technical" for users - or maybe they just don't believe in using a long-established body of theory?

So, to help my understanding of GTFS I put together a simple diagram of the data model.  I used Google Diagrams, which is why this looks a little primitive.   (Hmmm... maybe another reason they don't do diagrams is that they are religious about dog-fooding?)



After doing this I found the paper A Transmodel based XML schema for the Google Transit Feed Specification, which has a much more detailed UML model of GTFS:


The end goal of doing all this was to be able to transform a GTFS data feed into shapefile format.  For this I used a simple JEQL script.  But that's another blog post.

8 comments:

James said...

hi there - do you have higher resolution pdf's of these that you can share? i'm having trouble reading it but i think it would be very helpful to have as i'm just starting on a project using gtfs as a db. thanks!

Dr JTS said...

The diagram I did is pretty readable, I think. For the more detailed one, you'll have to contact the authors of the original paper.

Patrick Sunter said...

Hi Martin - I put a link to this post in a page about GTFS I just created on the Appropedia appropriate/sustainable tech wiki :- www.appropedia.org/GTFS .

Would it be OK if I also upload and display your diagram on that page, as long as its attributed to you with a link to your blog?

Thanks, Pat Sunter.

Dr JTS said...

Sure, Pat, that's no problem.

Gestão Empresarial FGV said...

Hi there,
Thanks for the excellent diagram, it helped me so much. I'm modelling a public transport network as a complex network using graph theory, so is not easy to transforma the data files into relevant information, but this model made my work easy.
Best.

Neil said...

Hi Martin,

Just stumbled across this data model diagram on the Appropedia GTFS page (mentioned above) and traced it back to your blog.

I agree with your surprise about the lack of a data model diagram in the GTFS specification. We at AddTransit have designed software to create and maintain GTFS files, and the first thing I did when reading the specification was look for the diagram to show me how all the files were linked together. Needless to say had to produce an almost identical diagram before we got started. At the same time we were left scratching our heads about why zones and blocks didn't get files of their own.

Anyway, as your diagram already has some traction, would you be ok with me forwarding your diagram to the people who maintain the GTFS specification with a suggestion that they add something similar to the spec?

Neil

Dr JTS said...

Sure, Neil, no problem with forwarding the diagram to whomever.

Neil said...

Thanks Martin