Skip to content
Quyen Tran edited this page Oct 24, 2015 · 7 revisions

Setting up OneBusAway for multiple agencies

Outline of steps

  1. Set up the OneBusAway environment with onebusaway.war and the the GTFS files.
  2. Create the bundle.xml file.
  3. Generate the combined bundle file.
  4. Run the onebusaway.jar web app.
  5. Add the mobile app API keys.

1. Setting up the OneBusAway environment

  1. Follow the instructions at Home through step "3. Downloading Miami-Dade Transit GTFS file".
  2. Download any other GTFS zip file such as miami.zip and broward.zip.
  3. Go to http://developer.onebusaway.org/modules/onebusaway-application-modules/1.1.11/guides/transit-data-bundle-guide.html for a reference of the instructions.

2. Create the bundle.xml file

  1. Create a bundle.xml file in the same directory as onebusaway.war with the following contents:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:context="http://www.springframework.org/schema/context"
    xsi:schemaLocation="
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">

    <bean id="gtfs-bundles" class="org.onebusaway.transit_data_federation.bundle.model.GtfsBundles">
        <property name="bundles">
            <list>
                <ref bean="gtfsA" />
                <ref bean="gtfsB" />
                <!-- References to other GTFS feeds could go here -->
            </list>
        </property>
    </bean>

    <bean id="gtfsA" class="org.onebusaway.transit_data_federation.bundle.model.GtfsBundle">
        <property name="path" value="miami.zip" />
        <property name="defaultAgencyId" value="1" />
        <property name="agencyIdMappings">
            <map>
                <!-- Map GTFS Agency IDs to their APTA Agency Id -->
                <entry key="MDT" value="1" />
            </map>
        </property>
    </bean>

    <bean id="gtfsB" class="org.onebusaway.transit_data_federation.bundle.model.GtfsBundle">
        <property name="path" value="broward.zip" />
        <property name="defaultAgencyId" value="2" />
        <property name="agencyIdMappings">
            <map>
                <!-- Map GTFS Agency IDs to their APTA Agency Id -->
                <entry key="BCT" value="2" />
            </map>
        </property>
    </bean>
 
</beans>

For each agency's GTFS zip file, create a "bean" section. Note the file "miami.zip" is specified.

    <bean id="gtfsA" class="org.onebusaway.transit_data_federation.bundle.model.GtfsBundle">
        <property name="path" value="miami.zip" />
        <property name="defaultAgencyId" value="1" />
        <property name="agencyIdMappings">
            <map>
                <!-- Map GTFS Agency IDs to their APTA Agency Id -->
                <entry key="MDT" value="1" />
            </map>
        </property>
    </bean>

Remember to reference each bean in the "list" section

                <ref bean="gtfsA" />
                <ref bean="gtfsB" />

3. Generate the combined bundle file

  1. Use the following command to generate the bundle directory:
java -server -Xmx1G -jar onebusaway.war -build -P tripEntriesFactory.throwExceptionOnInvalidStopToShapeMappingException=false -P distanceAlongShapeLibrary.localMinimumThreshold=50 -P distanceAlongShapeLibrary.maxDistanceFromStopToShapePoint=1000 bundle.xml combinedbundle
  1. After the bundle is generated, go to the 'combinedbundle' directory and check that it is about 111MB.

4. Run the onebusaway.jar web app

  1. Run the following command:
java -Xmx1G -server -jar onebusaway.war
  1. Note that the -server option allows more memory to be allocated.
  2. Specify the bundle directory when prompted. Ex: "C:\oba\combinedbundle"
  3. When the web app runs, access it at the server's IP address. Ex: "http://52.11.122.22:8080"

5. Add the mobile app API keys

  1. Using the web interface, login using the admin account (admin/password). Ex: "http://52.11.122.22:8080/login.action"
  2. Add the following API keys for Android and iOS with interval of 0:
  • v1_BktoDJ2gJlu6nLM6LsT9H8IUbWc=cGF1bGN3YXR0c0BnbWFpbC5jb20=
  • org.onebusaway.iphone
  1. Use the mobile app and set the "OneBusAway API Server" to the IP address and port. Ex: "52.11.122.22:8080"
  2. Zoom in to street level to see the bus stops.