OneBusAway / onebusaway-gtfs-modules

A Java-based library for reading, writing, and transforming public transit data in the GTFS format, including database support.

Home Page:https://github.com/OneBusAway/onebusaway-gtfs-modules/wiki

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

agencyid can be wrong in the GtfsStops table

jheld opened this issue · comments

Hibernating the MBTA's GTFS file (and the database has nothing in it, yet), shows that the agencyid in the GtfsStops table is always different (2 instead of 1) than what the agencyid in GtfsAgencies and GtfsRoutes tables. There are only 2 agencies in my feed, so unless there was some error in the processing of the data (hopefully data driven), I don't know that would happen. The route has the correct info, but that makes sense because that table/file already has that info. The stops would just get it from the trips->stop_times, right? So, I imagine there should be no ambiguity.

Update:
This seems to be due to the default agencyid resolver picking the first agencyid if no default is present.
In my case, the ordering in the CSV was 2,1, so it was always going to be wrong.

Was the assumption here that if there was more than one agency in the feed that they would literally be sharing all stop_id? So it wouldn't matter which agency got picked? Or that it was expected to only have one agency?

Either way, it's wrong for most of my use cases. I can fix my feed to have the ordering in ascending, but one set of my stops will still have the wrong agency...it just so happens I'm only looking at one of the agencies.