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

No support for multi-agency selection in Hibernate-cli

jheld opened this issue · comments

When using the Hibernate-cli, I found that if there was more than one agency in the feed, the GtfsStops and other models that had an agency field would resolve to just the first agency present in the CSV.

I wouldn't mind giving you a PR as a fix to resolve the feed correctly (using more advanced look ups), but I can't figure it out.

Is this something you're aware of? Know of a fix?

Instead of defining "agencyId" in the datasource, you can define "agencyIds", which GtfsRealtimeSource will then attempt to take a tripId off the feed and match to the appropriate agency -- assuming its unique. The syntax looks like this:

<bean class="org.onebusaway.transit_data_federation.impl.realtime.gtfs_realtime.GtfsRealtimeSource">
      <property name="tripUpdatesUrl" value="http://feed.example.com/cgi/trip-updates.sh" />
      <property name="vehiclePositionsUrl" value="http://feed.example.com/cgi/vehicle-positions.sh" />
      <property name="refreshInterval" value="30"/>
      <property name="agencyIds">
                <list>
                                <value>1</value>
                                <value>40</value>
                                <value>23</value>
                                <value>KMD</value>
                </list>
       </property>
    </bean>

If this solves your problem let me know and I'll close this issue.