Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reinstate urbica #4

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
*.obj
*.pbf
*.zip

.DS_Store
graphs/
osmconvert*
10 changes: 5 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
FROM java:8-alpine
LABEL maintainer="Stepan Kuzmin <[email protected]>"
FROM adoptopenjdk/openjdk11:jre-11.0.13_8-alpine
LABEL authors="Stepan Kuzmin <[email protected]>, Sandeep Pandey <[email protected], Tariq Baig-Meininghaus [email protected]"

ENV OTP_VERSION=1.4.0
ENV JAVA_OPTIONS=-Xmx1G
ENV OTP_VERSION=2.0.0
ENV JAVA_OPTIONS=-Xmx2G

ADD http://central.maven.org/maven2/org/opentripplanner/otp/$OTP_VERSION/otp-$OTP_VERSION-shaded.jar /usr/local/share/java/
ADD https://repo1.maven.org/maven2/org/opentripplanner/otp/$OTP_VERSION/otp-$OTP_VERSION-shaded.jar /usr/local/share/java/

RUN ln -s otp-$OTP_VERSION-shaded.jar /usr/local/share/java/otp.jar

Expand Down
51 changes: 25 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,45 +8,37 @@ Build graphs using GTFS and OSM extract in the current directory:

```shell
docker run \
-v $PWD:/graphs \
-e JAVA_OPTIONS=-Xmx4G \
urbica/otp --build /graphs
-v $PWD/graphs:/var/otp/graphs \
-e JAVA_OPTIONS=-Xmx4G \
urbica/otp --build \
--save /var/otp/graphs/city_name
```

Run OTP server:
Run OTP server by loading the graph, and exposing OTP's port 8080 to our machine's port 8080:

```shell
docker run \
-p 8080:8080 \
-v $PWD:/var/otp/graphs \
-v $PWD/graphs:/var/otp/graphs \
-e JAVA_OPTIONS=-Xmx4G \
otp --server --autoScan --verbose
urbica/otp --load /var/otp/graphs/city_name/
```

...or run OTP server with analyst module:

```shell
docker run \
-p 8080:8080 \
-v $PWD:/graphs \
-e JAVA_OPTIONS=-Xmx4G \
urbica/otp --basePath /data --server --analyst --autoScan --verbose
```
It seems [Analyst API ](https://docs.opentripplanner.org/en/latest/OTP2-MigrationGuide/#analyst "Analyst API ")have been removed in this version.

## Basic Tutorial

Based on [OpenTripPlanner Basic Tutorial](https://opentripplanner.readthedocs.io/en/latest/Basic-Tutorial/).
Based on [OpenTripPlanner Basic Tutorial](https://docs.opentripplanner.org/en/latest/Basic-Tutorial/).

### Get some data

Get GTFS for Transit Schedules and Stops
Get GTFS for Transit Schedules and Stops (As a sample for Portland),

```shell
mkdir -p ./graphs/portland
wget "http://developer.trimet.org/schedule/gtfs.zip" -O ./graphs/portland/trimet.gtfs.zip
```

Get OSM extract for Streets
Get OpenStreetMap extract for the streets. osmconvert step is used to reduce the data size, you can skip this step if you've allocated sufficient memory to your docker. Otherwise [download](hthttps://wiki.openstreetmap.org/wiki/Osmconvert#Binariestp:// "download") osmconvert.

```shell
wget http://download.geofabrik.de/north-america/us/oregon-latest.osm.pbf
Expand All @@ -56,30 +48,37 @@ mv portland.pbf ./graphs/portland

### Start up OTP

Build graph


Build graphs using GTFS and OSM extract in the current directory:

```shell
docker run \
-v $PWD/graphs:/var/otp/graphs \
-e JAVA_OPTIONS=-Xmx4G \
urbica/otp --build /var/otp/graphs/portland
-v $PWD/graphs:/var/otp/graphs \
-e JAVA_OPTIONS=-Xmx4G \
urbica/otp --build \
--save /var/otp/graphs/portland
```

Run OTP server:
Run OTP server by loading the graph, and exposing OTP's port 8080 to our machine's port 8080:

```shell
docker run \
-p 8080:8080 \
-v $PWD/graphs:/var/otp/graphs \
-e JAVA_OPTIONS=-Xmx4G \
urbica/otp --server --autoScan --verbose
urbica/otp --load /var/otp/graphs/portland
```

Alternatively, modify the `docker-compose.yml` and then execute:
```shell
docker-compose up
```
The graph build operation should take about one minute to complete, and then you'll see a Grizzly server running message. At this point you have an OpenTripPlanner server running locally and can open http://localhost:8080/ in a web browser. You should be presented with a web client that will interact with your local OpenTripPlanner instance.

This map-based user interface is in fact sending HTTP GET requests to the OTP server running on your local machine. It can be informative to watch the HTTP requests and responses being generated using the developer tools in your web browser.

### Usage
### Resources

There are a number of different resources available through the HTTP API. Besides trip planning, OTP can also look up information about transit routes and stops from the GTFS you loaded and return this information as JSON. For example:

Expand Down
14 changes: 5 additions & 9 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
version: '3.7'
version: '2.0'

services:
otp:
image: otp
image: urbica/otp
restart: unless-stopped
ports:
- 8080:8080
volumes:
- ./graphs:/var/otp/graphs
environment:
- JAVA_OPTIONS=-Xmx8G
- JAVA_OPTIONS=-Xmx2G
command:
[
'--server',
'--maxThreads 4',
'--analyst',
'--autoScan',
'--insecure',
'--verbose',
'--load /var/otp/graphs/portland',
'--maxThreads 4'
]