How to install OTP on a server? Guide for dummies please

1,170 views
Skip to first unread message

planea...@gmail.com

unread,
Feb 5, 2016, 9:50:38 AM2/5/16
to Transit Developers
I'm new to opentripplanner. I would like to install the OTP and use the API for realtime multimodal planning in The Netherlands. I'm a bit lost in all the different versions, manuals and websites that provide information. I wish there was 1 manual that I could just follow the steps and it would work, but unfortunately I haven't been able to find one. I tried installation on different versions of Ubuntu, but that didn't help much. I think that with the right knowledge it can't be that difficult and it shouldn't take very long to install and configure. 

As I am new, certain obvious steps/things may not be that obvious to me, so please if you can help me be precise with the steps I need to follow to install and configure. Thanks a lot in advance.

My Platform: Ubuntu 10.04 (Lucid) LTS

I found a lot of information on the internet, but a lot of it is old and often links are not working which didn't make my task any easier.

I followed several approaches, but they didn't work out. I'm a newbe to this, but I think installing and configuration can't be that difficult.

My question: How can I install OTP on my server and configure it ready for using the API?

See below.

=========================== Approach by Github:

// STEP 1:

sudo apt-get update
sudo apt-get install tomcat6 maven2 subversion default-jdk wget iptables tomcat6-examples tomcat6-admin
sudo apt-get install git

// STEP 2:

git clone https://github.com/opentripplanner/OpenTripPlanner
cd OpenTripPlanner 
git checkout stable

==> The below alternative didn't work: (error: branch cannot be found)

git clone https://github.com/opentripplanner/OpenTripPlanner.git
git checkout mmri-rt (for mmri-rt branch)
mvn package -DskipTests

// STEP 3: cd root

mkdir graph (upload changed config file "graph-config.xml", I used ftp)

// STEP 4:

mvn package -DskipTests
cd opentripplanner-graph-builder/target (error: /target not found)
java -Xmx2048M -jar graph-builder.jar /root/graph/graph-config.xml

==> The below also didn't work:

mvn package -DskipTests
./build-old /root/graph/graph-config.xml

=========================== Approach by Opentripplanner.org:

STEP 1:

cd root
mkdir otp
wget http://maven.conveyal.com.s3.amazonaws.com/org/opentripplanner/otp/0.19.0/otp-0.19.0-shaded.jar
wget http://maven.conveyal.com.s3.amazonaws.com/org/opentripplanner/otp/maven-metadata.xml
wget http://maven.conveyal.com.s3.amazonaws.com/org/opentripplanner/otp/0.19.0/otp-0.19.0.pom

STEP 2:

apt-get install maven2
mvn install:install-file -Dfile=otp-0.19.0-shaded.jar -DpomFile=otp-0.19.0.pom

STEP 3:

cd root/.m2/repository/org/opentripplanner/otp/0.19.0
java -jar otp-0.19.0.jar

==> error:

Exception in thread "main" java.lang.UnsupportedClassVersionError: org/opentripplanner/standalone/OTPMain : Unsupported major.minor version 52.0
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:643)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
        at java.net.URLClassLoader.access$000(URLClassLoader.java:73)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:212)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:323)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:268)
Could not find the main class: org.opentripplanner.standalone.OTPMain. Program will exit.

The below links provide information:

// Old github manual:

https://github.com/opentripplanner/OpenTripPlanner/wiki/SettingUpOTPServer

// Opentripplanner.org manual:

http://docs.opentripplanner.org/en/latest/Basic-Usage/#get-otp

// Build een graph file:

https://github.com/opentripplanner/OpenTripPlanner/wiki/GraphBuilder

// Run the webapp in Tomcat:

https://github.com/opentripplanner/OpenTripPlanner/wiki/RunningTheWebappInTomcat

// About realtime planner branch:

https://groups.google.com/forum/#!msg/transit-developers/MbGRNM9keJ8/vYmSKLQRKsQJ

// API DOC:

http://dev.opentripplanner.org/apidoc/0.15.0/

// Java doc:

http://dev.opentripplanner.org/javadoc/0.19.0/

// Issues with OTP

https://github.com/opentripplanner/OpenTripPlanner/issues/2193

// running webap in tomcat:

https://github.com/opentripplanner/OpenTripPlanner/wiki/RunningTheWebappInTomcat

// posts:

https://groups.google.com/forum/#!forum/opentripplanner-dev

Further question: On the site ( https://groups.google.com/forum/#!msg/transit-developers/MbGRNM9keJ8/vYmSKLQRKsQJ ) I read that a "graph-builder.xml" file is not used anymore in newer versions. Configuration should take place using the command line. But how can you safe a number of settings? As a backup for example to restore.



Andrew Byrd

unread,
Feb 5, 2016, 10:25:09 AM2/5/16
to transit-d...@googlegroups.com, planea...@gmail.com
Hi Bastiaan,

I’m responding again in hopes that it will help anyone else who comes upon this thread.

All of the instructions cited in Bastiaan’s message are either very outdated or refer to very specific circumstances that should only be encountered by developers modifying the source code of OTP and re-building it from scratch.

Please do not refer to the project wiki if you are starting out with OTP. As mentioned on the landing page, the wiki should be considered legacy documentation and is completely superseded by the documentation automatically published at http://opentripplanner.readthedocs.org/
 
The Basic Usage page should be a good starting point: http://opentripplanner.readthedocs.org/en/latest/Basic-Usage/

It’s unfortunate that you had to dredge through such a large amount of irrelevant documentation. I may need to delete the legacy wiki docs entirely if they are crowding the current documentation out of search engine results. However, we have made an effort to make links to the documentation all over the place, e.g. the “docs” link at the top of opentrippplanner.org, the “main documentation” link at the top of the GitHub landing page, the first paragraph of the wiki landing page, etc. 

I am having a hard time understanding why many people are still referring to the outdated documentation and unable to get to the current documentation. Where did you first look, and was there no link to Readthedocs? Feel free to reply to me off-list or on one of the OTP lists.

Regards,
Andrew Byrd

--
You received this message because you are subscribed to the Google Groups "Transit Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to transit-develop...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

planeandtrain West

unread,
Feb 6, 2016, 12:56:21 PM2/6/16
to Transit Developers, planea...@gmail.com

I hope it is helpful for other newbies, the below steps allowed me to install OTP on my Ubuntu 14.04 server:

=> Create directory:

cd /home
mkdir planner
cd planner
mkdir otp
cd otp

=> Download gtfs and OSM:
wget "http://developer.trimet.org/schedule/gtfs.zip" -0 trimet.gtfs.zip
wget https://s3.amazonaws.com/metro-extracts.mapzen.com/portland_oregon.osm.pbf

=> Get java 1.8 or higher:
sudo apt-get update
sudo apt-get install default-jre
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java8-installer

=> Download opentripplanner:
wget http://maven.conveyal.com.s3.amazonaws.com/org/opentripplanner/otp/0.19.0/otp-0.19.0-shaded.jar

=> Run the standalone executable:
java -Xmx4G -jar otp-0.19.0-shaded.jar


I found that the following configuration files can be used:

  1. 1.      otp-config.json
  2. 2.      build-config.json
  3. 3.      router-config.json
  4. 4.      an XML file for bicycle renting systems


Please find summarized the settings I was able to find for each file:

// otp-config.json

{

 

}

 

 

// build-config.json

{

subwayAccessTime: 2.5,
            stationTransfers: true,

fetchElevationUS: true,

"elevationBucket" : {

    "accessKey" : "your-aws-access-key",

    "secretKey" : "corresponding-aws-secret-key",

   "bucketName" : "ned13"

},

 

// Select the custom fare "seattle"

fares: "seattle",

// OR this alternative form that could allow additional configuration

fares: {

    type: "seattle"

},

 

fares: {

// Combine two fares by simply adding them

combinationStrategy: "additive",

// First fare to combine

fare0: "new-york",

// Second fare to combine

fare1: {

  type: "bike-rental-time-based",

  currency: "USD",

  prices: {

  // For trip shorter than 30', $4 fare

  "30":   4.00,

  // For trip shorter than 1h, $6 fare

  "1:00": 6.00

}

            }

},

osmNaming: "portland"

}

 

 

// build-config.json

{

routingDefaults: {

    walkSpeed: 2.0,

    stairsReluctance: 4.0,

    carDropoffTime: 240

},

boardTimes: {

  AIRPLANE: 2700

},

alightTimes: {

  AIRPLANE: 1200

},

timeouts: [5, 4, 3, 1],

    // Routing defaults are any public field or setter in the Java class

    // org.opentripplanner.routing.core.RoutingRequest

    routingDefaults: {

        numItineraries: 6,

        walkSpeed: 2.0,

        stairsReluctance: 4.0,

        carDropoffTime: 240

    },

 

    updaters: [

 

        // GTFS-RT service alerts (frequent polling)

        {

            type: "real-time-alerts",

            frequencySec: 30,

            url: "http://developer.trimet.org/ws/V1/FeedSpecAlerts/appID/0123456789ABCDEF",

            feedId: "TriMet"

        },

 

        // Polling bike rental updater.

        // sourceType can be: jcdecaux, b-cycle, bixi, keolis-rennes, ov-fiets,

        // city-bikes, citi-bike-nyc, next-bike, vcub, kml

        {

            type: "bike-rental",

            frequencySec: 300,

            sourceType: "city-bikes",

            url: "http://host.domain.tld"

        },

 

        <!--- San Francisco Bay Area bike share -->

        {

          "type": "bike-rental",

          "frequencySec": 300,

          "sourceType": "sf-bay-area",

          "url": "http://www.bayareabikeshare.com/stations/json"

        }

 

        // Polling bike rental updater for DC bikeshare (a Bixi system)

        // Negative update frequency means to run once and then stop updating (essentially static data)

        {

            type: "bike-rental",

            sourceType: "bixi",

            url: "https://www.capitalbikeshare.com/data/stations/bikeStations.xml",

            frequencySec: -1

        },

 

        // Bike parking availability

        {

            type: "bike-park"

        }

 

        // Polling for GTFS-RT TripUpdates)

        {

            type: "stop-time-updater",

            frequencySec: 60,

            // this is either http or file... shouldn't it default to http or guess from the presence of a URL?

            sourceType: "gtfs-http",

            url: "http://developer.trimet.org/ws/V1/TripUpdate/appID/0123456789ABCDEF",

            feedId: "TriMet"

        },

 

        // Streaming differential GTFS-RT TripUpdates over websockets

        {

            type: "websocket-gtfs-rt-updater"

        },

 

        // OpenTraffic data

        {

          "type": "opentraffic-updater",

          "frequencySec": -1,

          // relative to OTP's working directory, where is traffic data stored.

          // Should have subdirectories z/x/y.traffic.pbf (i.e. a tile tree of traffic tiles)

          "tileDirectory": "traffic"

        }

    ]

 

}

Bicycle rental systems, the following settings can be used:

<?xml version="1.0" encoding="utf-8" ?>

<kml xmlns="http://www.opengis.net/kml/2.2">

<Document id="root_doc">

<Schema name="citybikes" id="citybikes">

    <SimpleField name="ID" type="int"></SimpleField>

</Schema>

  <Placemark>

    <name>A Bike Station</name>

    <ExtendedData><SchemaData schemaUrl="#citybikes">

        <SimpleData name="ID">0</SimpleData>

    </SchemaData></ExtendedData>

      <Point><coordinates>24.950682884886643,60.155923430488102</coordinates></Point>

  </Placemark>

</Document></kml>


This is the latest API documentation I found:

http://dev.opentripplanner.org/apidoc/0.15.0/

 

With regards to the above I have the following Questions:

  1. 1.      BUILDING JAR: Is this the source code that can be cloned to my server to make a build (https://github.com/opentripplanner/OpenTripPlanner/tree/otp-0.19.0/)  that use is also used for building the otp-0.19.0-shaded.jar executable that referred to here: http://opentripplanner.readthedocs.org/en/latest/Basic-Usage/ ?
  2. 2.      API / GRAPHBUILDER: Which settings can be used to define allowed modalities (e.g.: Bike, Walk, Drive) for START, MAIN, END of journey separately? I can only find the modal settings where a comma separated list of modalities can be entered that define allowed modalities for the entire journey, and I was able to find a setting to use  bike parkings, but that didn’t meet my requirements.
  3. 3.      API / GRAPHBUILDER: There is a Maximum radius for walking, but can I also set a max radius for driving and bicycling in case those modalities are used, and can I also define a different setting for START, MAIN, END of journey?
  4. 4.      CONFIGURATION FILES (build-config.json, otp-config.json, build-config.json): There is a lot more documentation outside of opentripplanner.org that describe more settings, but they apply to older versions and are in xml format. Where can I find all the configurations settings that can be used in those files? Further, I didn’t find any available settings for the file “otp-config.json”.
  5. 5.      GRAPHBUILDER: How can I update the GTFS data (can this only be done when building the graph or can I easily setup a scheme)? And if both GTFS and GTFS-RT data are used, will GTFS-RT data always be used instead of GTFS data if both are available for the same trip?
  6. 6.      CONFIGURATION FILES: With regards to the KLM file for bicycle renting systems, can this be written in xml instead of json, what is the filename to save and can it be saved in the graph dir?
  7. 7.      API: Are there more parameters available in version 0.19 than in the above API documentation for version 0.15? Where can I find them? Not all parameters are clearly described what they are used for, is there any other place where I could find out about it?

Best regards,


Bastiaan

 


Op vrijdag 5 februari 2016 16:25:09 UTC+1 schreef Andrew Byrd:
Hi Bastiaan,

To unsubscribe from this group and stop receiving emails from it, send an email to transit-developers+unsub...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages