This vignette is to provide guidance for people who are completely unfamiliar with Open Trip Planner and/or R. It assumes no prior-knowledge. If you are familiar with R and/or OTP then you may find the Getting Started vignette more useful.
The Open Trip Planner for R package makes it easier for R and Open Trip Planner to communicate.
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.
You can find a lot more information about OTP at:
R is a 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.
You can find a lot more information about R at:
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.
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 private computer or server. If you want, analyse a transport network OTP is a very useful and 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 a 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.
You will need to install some software to use OTP and R.
For more information and advanced options, see http://docs.opentripplanner.org/en/latest/Getting-OTP/
For now just keep the .jar file somewhere where you can find it, we will use it later.
A video tutorial for installing R and RStudio
If you have never used R before there a lots of free tutorials to get you started, such as: https://www.datacamp.com/courses/free-introduction-to-r http://www.r-tutor.com/r-introduction
Once you have R and RStudio installed open RStudio. There are two version of an R package the public release on CRAN and the development version on GitHub.
OTP for R is not yet available on CRAN, we are working towards a CRAN release soon.
To get the latest release of OTP for R you will need to run the following lines of code.
install.packages("opentripplanner")
When installing the OTP for R package, R will also install any other packages that are required.
The development version is a work in progress and may contain untested or incomplete features. It is not recommended for beginners. To get the latest development version you will need to run the following lines of code.
install.packages("devtools") devtools::install_github("marcusyoung/opentripplanner")
This code will install a package called “devtools” and then use that package to install OTP for R from github. When installing the OTP for R package, R will also install any other packages that are required.
Once the package has been installed you will need to activate it by running this line of code.
library(opentripplanner)
Now that you have installed Open Trip Planner for R got to the Getting Started vignette, to find how to create a graph and use it to plan trips. You might also interested in:
To plan a trip OTP need data about the location, such as where the roads are, what is the public transport timetable etc.
OTP uses road maps from the Open Street Map (OSM) https://www.openstreetmap.org in the .pbf format. OSM is a free map that anybody can edit. You can download all of part of the OSM from https://download.geofabrik.de/.
This package comes with some sample data for Greater Manchester https://download.geofabrik.de/europe/great-britain/england/greater-manchester.html
OTP can use public transport timetable data in the GFTS format. You can find GTFS data for many regions at https://transit.land/
You can add terrain information to your routes, especially useful for walking and cycling using GeoTIFF images. You can find world wide elevation data at https://www2.jpl.nasa.gov/srtm/ .
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.