GeoPython 2023

Urbantrips: an opensource library to analyze public transit smart card data
2023-03-06, 15:00–15:30, Auditorium

Urbantrips is an open-source library that takes information from a public transportation smart card payment system and produces origin-destination matrices and some KPIs for bus routes. Work behind this involves inferring destinations, creating chain trips and several spatial transformations using H3, and Pandas optimization and parallelization processes to make it more performant.


Public transportation was heavily affected by COVID, financially and in terms of ridership. Also, travel patterns shifted, with telecommuting and office relocations. Unlike rail and subway, bus networks can adapt to these changes. Urbantrips is an open-source tool that transportation agencies can use to measure how their bus system is performing in these stressful times. It may also suggest ways the network and its users can be better served by changes in the network.

We’ll use publicly available data from the Buenos Aires urban area (~17 million people), served by heavy rail, subway, and one of the largest bus systems in the world (19k buses). We’ll show a step-by-step of the alighting and drop-off estimation. Also, we’ll display how we use pandas optimization and parallelization processes, combined with H3 schema that allows us to conduct spatial processes like buffers and distances in a more efficient way. Finally, we’ll show our results and how these KPIs can be used to optimize the bus network in Buenos Aires, and can be also used in other cities.