Prerequisites

Malcolm Morgan

2020-01-20

Introduction

This vignette provides guidance for people who new to OpenTripPlanner (OTP) and R. After you have R and OTP installed and have become familiar with them (e.g. by reading this vignette), we recommend working through Getting Started vignette.

Why would I want to use OpenTripPlanner for R?

OpenTripPlanner (OTP) is a free, open-source, and cross-platform multi-modal route planner written in Java. It is like having your own private version of Google Maps. OTP can be used to run public route-finding services such as https://ride.trimet.org but it can also be run on your own computer or server. If you want to analyse a transport networks OTP is a very useful tool. However, OTP is, as the name suggests, a Trip Planner, not analytical software. So, while OTP can find the fastest route from A to B or find all the places that are within a 20-minute walk of C, it cannot answer a question like “how many people live within 10-minutes of a park?” This is where R can help. R can process multiple spatial datasets such as population densities and park locations but does not have a built-in journey planner.

This package allows you to use the trip planning power of OTP with the analytical might of R.

What is this package for, and what is a package anyway?

The opentripplanner R package makes it easier for R and OpenTripPlanner to communicate. Specifically, it allows you to do use R to control OTP and use it as a local routing service. For more on local versus remote routing services, see the Transportation chapter in Geocomputation with R.

What are R and RStudio?

R is an open-source programming language and free software environment for statistical computing and graphics. R has many capabilities for analysing data and writing software, but in this context, its ability to produce and analyse spatial data and maps is most relevant. RStudio is an Integrated Development Environment (IDE) for R which is free for personal use.

What is an R package?

An R package is a small piece of software that extends the basic capabilities of R. It is a bit like how a new phone can do some things out of the box (make phone calls, send email) but you have to install apps to add extra abilities.

Help with R

To get started with R, see An Introduction to R or from within R by running help.start(), introductory tutorials such as DataCamp’s free Introduction to R course, or the R tutor website. The Geocomputation with R book covers the packages and skills required to analyse spatial datasets such as those produced by OpenTripPlanner.

A video tutorial for installing R and RStudio

What do I need to get started?

You will need a modern computer and to install some software to use OTP and R on your local computer.

Hardware

Running your own trip planner is computationally expensive an so the best results will be had on a modern desktop computer. This package comes with some demonstration data for the Isle of Wight, which as a very small area will run on most modern laptops and desktops.

Recommended Hardware

Minimum Hardware

OTP requires at least 1 GB of space to run the demonstration dataset, but by default will request 2 GB. On low-end machines, it is necessary to change the default memory allocations and minimise memory use by other programmes.

For larger areas OTP will need more memory. An approximate guide to memory use is:

OTP is optimised for city-scale routing and performance will degrade with larger areas, although OTP is used successfully with several small European Countries e.g. the Netherlands.

Note If you use a 32 Bit version of Java the maximum amount of memory that can be used by OTP is 4 GB.

Software

The OpenTripPlanner for R package requires:

Download and install Java 8. You will need the correct version for your operating system. If possible the 64 Bit version of Java is preferable, especially if you want to use OTP over large areas.

To get Java:

For Debian based Linux including Ubuntu and Linux Mint, the follwoing commands in the terminal will install the correct version.

sudo apt install openjdk-8-jdk

Next Steps

Now that you have installed Java and R go to the Getting Started vignette, to find how to install the package, create a graph, and use it to plan trips.