-
Notifications
You must be signed in to change notification settings - Fork 17
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
Updated for OTP v2 #2
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
*.obj | ||
*.pbf | ||
*.zip | ||
|
||
.DS_Store | ||
graphs/ | ||
osmconvert* |
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 lpicanco/java11-alpine:11.0 | ||
LABEL authors="Stepan Kuzmin <[email protected]>, Sandeep Pandey <[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 | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,49 +4,52 @@ | |
|
||
## Usage | ||
|
||
Build graphs using GTFS and OSM extract in the current directory: | ||
Build the docker image from the Dockerfile: | ||
|
||
```shell | ||
docker run \ | ||
-v $PWD:/graphs \ | ||
-e JAVA_OPTIONS=-Xmx4G \ | ||
urbica/otp --build /graphs | ||
docker build -t my_docker_id/otp . | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do you need this step? There is ready to use |
||
``` | ||
|
||
Run OTP server: | ||
Build graphs using GTFS and OSM extract in the current directory: | ||
|
||
```shell | ||
docker run \ | ||
-p 8080:8080 \ | ||
-v $PWD:/var/otp/graphs \ | ||
-e JAVA_OPTIONS=-Xmx4G \ | ||
otp --server --autoScan --verbose | ||
-v $PWD/graphs:/var/otp/graphs \ | ||
-e JAVA_OPTIONS=-Xmx4G \ | ||
my_docker_id/otp --build \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One can use |
||
--save /var/otp/graphs/city_name | ||
``` | ||
|
||
...or run OTP server with analyst module: | ||
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 \ | ||
-v $PWD/graphs:/var/otp/graphs \ | ||
-e JAVA_OPTIONS=-Xmx4G \ | ||
urbica/otp --basePath /data --server --analyst --autoScan --verbose | ||
my_docker_id/otp --load /var/otp/graphs/city_name/ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here |
||
``` | ||
|
||
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 | ||
Clone this repo to your machine. | ||
```shell | ||
git clone https://github.com/ikespand/docker-otp | ||
cd docker-otp | ||
``` | ||
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 | ||
|
@@ -56,30 +59,41 @@ mv portland.pbf ./graphs/portland | |
|
||
### Start up OTP | ||
|
||
Build graph | ||
Build the docker image from the Dockerfile: | ||
|
||
```shell | ||
docker build -t ikespand/otp . | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What is the reason changing |
||
``` | ||
|
||
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 \ | ||
ikespand/otp --build \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Saeme question here |
||
--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 | ||
ikespand/otp --load /var/otp/graphs/portland | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Saeme question here |
||
``` | ||
|
||
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: | ||
|
||
|
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: ikespand/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/stuttgart', | ||
'--maxThreads 4' | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is your reason to change the baseimage?