This is Python implementation of "Transit trip itinerary inference with GTFS and smartphone data", TII
Many emerging technologies have been developed to supplement and contribute to conventional household travel surveys for transport-related data collection. A great deal of research has concentrated on the inference of information from global positioning system (GPS) data and data collected from mobile phones; methods for inferring transit itinerary have not received much attention. Automatic detection of transit itineraries from smartphone travel surveys could be used by planning agencies to predict transit demand and help in analysis of transit planning scenarios. This paper describes a proposed approach to infer transit itinerary smartphone travel survey and general transit feed specification data from Montreal, Quebec, Canada. Transit trips from the 2013 household travel survey were recreated and recorded with the DataMobile smartphone travel survey from May to July 2016. Transit itineraries were then validated—that is, collected data were associated with transit routes for all parts of the trips. The proposed transit itinerary inference algorithm was then applied to these validated data. The approach relied on the notion of transit route ambiguity—that is, because transit routes can overlap, any attempt to associate GPS data with routes when routes do overlap will result in ambiguity in identifying which routes were actually used. The proportion of transit trips with associated transit routes that were ambiguous was calculated under different assumptions, rules, and eventually a simple algorithm. Findings indicate that, by using this approach, 94.2% of transit trip distance can be assigned to either one transit route or walking, and thus there is reduced ambiguity. This resulted in 87% correct prediction of transit routes.