Wednesday, March 4, 2015

Mapping the Transit System of Rio with GTFS data

Here is my first experience mapping a transit system using GTFS data!

The map shows the bus public transport system of the city of Rio de Janeiro as of November 2014. The blue lines represent the bus routes, where color intensity and width vary according to service frequency per day. I have also included the city's street grid in the background (gray) to give a visual idea of the transport system coverage.

click on the image to enlarge it

The map was created in R (ggplot) using data from OpenStreetMap (OSM) and GTFS data provided by Fetranspor/Va de onibus (this is basically the same transit data people have access to in their mobile apps). This great map by James Cheshire was the main inspiration, although I couldn't get to such a nice result as James did.

I've created this map a couple of months ago but still need to organize the R code before sharing it here with you. I am also working on an interactive version of this map, but this may take a little longer  I've been facing some deadline issues lately  Stay tuned.

Related Links


Jose Manuel said...

This really inspired me to do one, but i´m sutck for México city. How did you know the frecuency is there any math or formula. I happened to subtracting the end time of start and then dividing by the total hours of service, multiplied by seven times the frequency would give me a week to urban transport. I 'm right or wrong?

Rafael H M Pereira said...

Hi Jose. I'm glad you liked it. You can access GFTS data from Mexico City in the linke here:

With GTFS data you can get all the information on routes, location of bus stops and frequency of service etc.

More info about GTFS of Mexico City, here:

alex salgado said...

How can I have access to the GTFS file from Rio?

Rafael H M Pereira said...

Hi Alex. Sorry for my late response. To get access to GTFS data from Rio you need to get in contact with Fetranspor ( who "owns" and manages the data. I had to sign a contract with them.

Thiago de Sá said...

Rafa, brilliant!

Do you know if bike sharing systems also have GFTS data? I know some systems have GPS attached to their bikes...

Rafael H M Pereira said...

Thiago, GTFS data does not cover bike sharing systems. A rich source of data on this topic, though, is provided by Oliver O'Brien, who created and live map of docking stations associated with bicycle sharing systems from 100+ cities around the world. Here is the link:

Fernando said...

Hi Rafael,

Do you know who is the person we should contact to sign the contract and get access to the data?

Thanks in advance,

Leo said...


Rafael H M Pereira said...

Thanks Leo. I had seen this links a few weeks ago, but I've checked the data and it quite incomplete :( So they are realising data that do not cover all lines in the transit system of Rio . Let's hope the correct the data in the next months