Skip to content
barbeau edited this page Feb 28, 2013 · 139 revisions

OpenTripPlanner for Tampa

OpenTripPlanner (OTP) is an open source multi-modal trip planner.

This project contains modifications to OTP for a Tampa-specific deployment. Find the main OTP project at OpenTripPlanner.org

Not a Developer?

If you want to help out the OTP deployment in Tampa, but you don't know Java from frappuccino, no worries! We still need your help mapping the Tampa Bay area in OpenStreetMap, since without good data, OTP can't give good directions. Check out our page for OpenStreetMap mapping project ideas, which has our most-wanted list of OSM improvements.

OTP Setup Shortcut for Tampa Developers

You'll need to follow the instructions for checking out the source given at the Developer Installation page on the main OTP wiki.

However, when checking out the code, instead of using the URI for the main OpenPlans repository when cloning the repository in Git, use the URI https://git@github.com/barbeau/OpenTripPlanner.git instead to grab the code from this repository, which is set up for the Tampa Bay area.

You'll need a graph (i.e., compiled OpenStreetMap, GTFS, and NED data) to use, so feel free to use the pre-compiled graph that includes HART and USF Bull Runner data from here for the Tampa area (note: the Graph.obj file is over 100MB, so download from a fast internet connection).

Make a directory on your hard drive off the root /OTPfiles/graph (e.g., if your running OTP off your C drive, the directory would be c:\OTPfiles\graph), and put the Graph.obj file from the above link in this directory.

Testing your instance

Open your browser and enter the URL http://localhost:8080/opentripplanner-webapp/ and press enter.

If all goes well, you should now have a working version of OTP on your computer that functions in Hillsborough County.

The OTP REST API should also be available at http://localhost:8080/opentripplanner-api-webapp/.

To query the API, use a RESTful request that looks something like this:

http://opentripplanner.usf.edu/opentripplanner-api-webapp/ws/plan?fromPlace=28.066788,-82.410104&toPlace=28.059324,-82.415394&mode=TRANSIT,WALK&min=QUICK&maxWalkDistance=840&time=2:49%20pm&date=10/24/2012&arr=Depart&itinID=1&wheelchair=false

Building Your Own Graph

The above example includes a pre-compiled graph for the Tampa, Fl area. However, if you'd like to build your own graph, the full official directions for building an OTP graph are on the GraphBuilder page.

You can use the below graph-config.xml file to build a graph using GTFS data for HART and USF Bull Runner.

graph-config.xml

<?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="gtfsBuilder" class="org.opentripplanner.graph_builder.impl.GtfsGraphBuilderImpl">
     <property name="gtfsBundles">
       <bean id="gtfsBundles" class="org.opentripplanner.graph_builder.model.GtfsBundles">
        <property name="bundles">
            <list>
                 <!-- Here's all the GTFS URL's that we know of for Florida   
                            HART - http://gohart.org/google/google_transit.zip
                            USF BullRunner - http://go.cutr.usf.edu/clearota/otp/Bull_Runner.zip
                            Miami Dade - http://www.miamidade.gov/transit/googletransit/current/google_transit.zip
                            Sarasota County Area Transit - http://www.scgov.net/SCAT/google/current/google_transit.zip
                            PSTA - http://www.psta.net/latest/google_transit.zip
                            Space Coast Area Transit - http://trilliumtransit.com/transit_feeds/spacecoast-fl-us/
                            Lee County Transit - http://www.gtfs-data-exchange.com/agency/lee-county-transit/latest.zip
                            Broward County - http://www.broward.org/bct/google/latest/google_transit.zip -->
                <bean class="org.opentripplanner.graph_builder.model.GtfsBundle">                        
                    <property name="url" value="http://gohart.org/google/google_transit.zip" />
                    <property name="defaultAgencyId" value="HART" />
                    <property name="defaultBikesAllowed" value="true" />
                </bean>                                 
            <!-- add additional GtfsBundles here -->
             <bean class="org.opentripplanner.graph_builder.model.GtfsBundle">
                    <property name="url" value="http://go.cutr.usf.edu/clearota/otp/Bull_Runner.zip" />
                    <property name="defaultAgencyId" value="USF Bull Runner" />
                    <property name="defaultBikesAllowed" value="true" />
                </bean>


             <bean class="org.opentripplanner.graph_builder.model.GtfsBundle">
                    <property name="url" value="http://www.psta.net/latest/google_transit.zip" />
                    <property name="defaultAgencyId" value="PSTA" />
                    <property name="defaultBikesAllowed" value="true" />
                </bean>
            </list>
        </property>
       </bean>
      </property>
      
      <property name="gtfsGraphBuilders">
         <list> 
             <bean class="org.opentripplanner.graph_builder.impl.transit_index.TransitIndexBuilder"/> 
         </list>
      </property>
   </bean>

   <bean id="osmBuilder" class="org.opentripplanner.graph_builder.impl.osm.OpenStreetMapGraphBuilderImpl">
     <property name="provider">        
            <bean class="org.opentripplanner.openstreetmap.impl.AnyFileBasedOpenStreetMapProviderImpl"> 
                <property name="path" value="D:\OTPfiles\DownloadedOSMFiles\florida.osm\florida.osm"/> 
            </bean>                
      </property>

      <property name="customNamer">
        <bean class="org.opentripplanner.graph_builder.impl.osm.PortlandCustomNamer" />
      </property>
      <property name="defaultWayPropertySetSource">
        <bean class="org.opentripplanner.graph_builder.impl.osm.DefaultWayPropertySetSource" />
        </property>
    </bean>

    <bean id="transitStreetLink" class="org.opentripplanner.graph_builder.impl.TransitToStreetNetworkGraphBuilderImpl" />
     
     <bean id="nedBuilder" class="org.opentripplanner.graph_builder.impl.ned.NEDGraphBuilderImpl">
      <property name="gridCoverageFactory">
        <bean class="org.opentripplanner.graph_builder.impl.ned.NEDGridCoverageFactoryImpl">
          <property name="cacheDirectory" value="/OTPfiles/ned" />
         </bean>
      </property>
    </bean>
 
    <bean class="org.opentripplanner.graph_builder.impl.CheckGeometryGraphBuilderImpl" id="checkGeometry"/>
    
    <bean class="org.opentripplanner.graph_builder.impl.map.MapBuilder" id="mapBuilder"/>

    <bean id="graphBuilderTask" class="org.opentripplanner.graph_builder.GraphBuilderTask">
      <property name="path" value="/OTPfiles/graph" /> 
      <property name="graphBuilders">
        <list>
          <!-- GTFS comes before OSM, because we use the loaded set of stops to determine our OSM coverage -->
          <ref bean="gtfsBuilder" />
          <ref bean="osmBuilder" />
          <ref bean="mapBuilder"/>
          <ref bean="checkGeometry"/>           
          <ref bean="nedBuilder" />
          <ref bean="transitStreetLink" />
        </list>
      </property>
    </bean>
</beans>

Deployment to opentripplanner.usf.edu

Our public instance of OpenTripPlanner is available at http://opentripplanner.usf.edu, and is running on the USF virtualized server opentripplanner.forest.usf.edu.

The OTP instance will need to be maintained in two ways:

  1. Build a new graph object (Graph.obj) from GTFS and OSM data whenever the current GTFS data expires
  2. Deploy new version of the OTP software (3 WAR files)

NOTE: It is highly recommended that you make a backup of the current Graph.obj file and current OTP WAR files before deploying new versions, so if anything goes wrong you can revert to the current versions.

For #1, you will need to build a graph using the opentripplanner-graph-builder project, which will produce a Graph.obj file. Then, remote desktop into opentripplanner.forest.usf.edu and copy the new Graph.obj file into the directory D:\OTPfiles\graph. Then, go to the Windows Services view and stop the "Apache Tomcat 6" service, which will shut down the server and make the page at http://opentripplanner.usf.edu unavailable. Then, restart the service, and wait a few minutes for it to finish startup. The web page at http://opentripplanner.usf.edu should now be back up with the newly built graph.

For #2, you will need to update the OTP code and then export the opentripplanner-api-webapp, opentripplanner-geocoder, and opentripplanner-webapp projects, so you have 3 WAR files, one for each project. Remote desktop into opentripplanner.forest.usf.edu and go to the Windows Services view and stop the "Apache Tomcat 6" service, which will shut down the server and make the page at http://opentripplanner.usf.edu unavailable. Then, delete the 3 current WAR files and their corresponding directories in the server folder D:\Tomcat6\webapps. Also delete the contents of D:\Tomcat6\webapps\ROOT. Then, copy the 3 new WAR files into the directory D:\Tomcat6\webapps. Then, restart the Windows Tomcat 6 service, and wait a few minutes for it to finish startup. Tomcat should automatically unzip the 3 WAR files into subdirectories in the D:\Tomcat6\webapps folder. Then, copy the contents of the folder D:\Tomcat6\webapps\opentripplanner-webapp to the folder D:\Tomcat6\webapps\ROOT, which will make the OTP webapp available at the root context. At this point, OTP should be back up and running when you browse to http://opentripplanner.usf.edu.

Clone this wiki locally