# OpenTripPlanner

[OpenTripPlanner (OTP)](https://www.opentripplanner.org/) is an open source multi-modal trip planner, focussing on travel by scheduled public transportation in combination with bicycling, walking, and mobility services, including bike share and ride hailing.

## What you need <a href="#opentripplanner--prerequisites" id="opentripplanner--prerequisites"></a>

* [Java Virtual Machine (JVM)](https://adoptium.net/en-GB/) (Java 17+)

To find out if you have **Java** installed:

1. Open PowerShell / Command Prompt (Windows) or Shell (Linux) and type:

```
java -version
```

2. Press *Enter*.\
   \&#xNAN;*If Java is installed, you should see a few lines of text detailing which version you have installed. If you get something along the lines of `"java is not recognized ..."`, please download JVM \[or OpenJDK] using the link above in 'What you need'.*

## Basic usage

In terms of creating a transit network using OS MRN, you'll require the following files (ensure that they are stored in the same directory):

* The [`otp-2.5.0-shaded.jar`](https://repo1.maven.org/maven2/org/opentripplanner/otp/2.5.0/otp-2.5.0-shaded.jar)"shaded" JAR (Java ARchive) containing OTP and all other libraries needed for it to work.
* Some General Transit Feed Specification (GTFS) data for Transit Schedules and Stops, for example, Bus Open Data Service (BODS).
* OS MRN Protocolbuffer Binary Format (PBF) data downloaded from the [OS Data Hub](https://osdatahub.os.uk/) (`OSMulti-modalRoutingNetwork.pbf`).

{% hint style="info" %}
The [General Transit Feed Specification (GTFS)](https://gtfs.org/) is an Open Standard used to distribute relevant information about transit systems to riders. It allows public transit agencies to publish their transit data in a format that can be consumed by a wide variety of software applications.

The [Bus Open Data Service (BODS)](https://www.bus-data.dft.gov.uk/) provides bus timetable, vehicle location and fares data for every local bus service in England.
{% endhint %}

The [OpenTripPlanner Basic Tutorial](https://docs.opentripplanner.org/en/latest/Basic-Tutorial/) provides a detailed set on instructions of how to get the interactive OTP instance up-and-running, but fundamentally the steps are as follows:

1. Open PowerShell / Command Prompt (Windows) or Shell (Linux) and navigate to the folder where the OTP JAR, BODS GTFS, and OS MRN PBF files have been stored.
2. Run the following command to start the service: `java -Xmx8G -jar otp-2.5.0-shaded.jar --build --serve . --port 8801`.
3. Go to <http://localhost:8801/> in a web browser.\ <br>

   <figure><img src="https://1897589978-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FcNpJpLP8RROUaWVQo5ea%2Fuploads%2F4eH6NpE4p572fStcYqy9%2Fopentripplanner.png?alt=media&#x26;token=f827b76f-4285-402a-a412-8b580d713cbd" alt="OpenTripPlanner UI showing example itineraries in Southampton in the map area which were created using OS MRN and GTFS bus timetable information in OpenTripPlanner. The base map in the map area shows the city of Southampton and a bus route across the city is highlighted by a green line. "><figcaption><p>OpenTripPlanner UI showing example itineraries in the map area which were created using OS MRN and GTFS bus timetable information in OpenTripPlanner.</p></figcaption></figure>


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.os.uk/os-downloads/products/transport-network-portfolio/os-multi-modal-routing-network/os-mrn-getting-started-guide/opentripplanner.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
