otp-setup/bsag/readme.md

153 lines
3.9 KiB
Markdown
Raw Permalink Normal View History

2023-03-07 14:20:07 +01:00
# Prepare host
* create user like [this](https://git.wtf-eg.de/dancesWithCycles/setup/src/branch/main/doc/gnu-linux-create-user.md)
2023-03-09 15:01:31 +01:00
* If required, install java like [this](https://git.wtf-eg.de/dancesWithCycles/setup/src/branch/main/doc/java.md)
* If required, install git like [this](https://git.wtf-eg.de/dancesWithCycles/setup/src/branch/main/doc/git.md)
* If required, install maven like [this](https://git.wtf-eg.de/dancesWithCycles/setup/src/branch/main/doc/maven.md)
2023-03-06 22:13:08 +01:00
# GTFS source file
2023-03-09 15:01:31 +01:00
* checkout [repo](https://github.com/OneBusAway/onebusaway-gtfs-modules.git) (ATTENTION: alternative download link for [onebusaway-gtfs-transformer-cli](http://developer.onebusaway.org/modules/onebusaway-gtfs-modules/1.3.4-SNAPSHOT/onebusaway-gtfs-transformer-cli.html))
2023-03-07 14:20:07 +01:00
```
2023-03-09 15:01:31 +01:00
git clone https://github.com/OneBusAway/onebusaway-gtfs-modules.git
2023-03-07 14:20:07 +01:00
```
* build tool
```
cd onebusaway-gtfs-modules
mvn clean package
```
2023-03-06 22:13:08 +01:00
* download GTFS data
```
wget -o ./wget-log-connect-ls-top-dhid.txt -O ./connect-ls-top-dhid.zip http://www.connect-info.net/opendata/gtfs/connect-nds-toplevel-dhid/<TOKEN>
```
2023-03-09 15:01:31 +01:00
* generate GTFS extract (ATTENTIONS: If server host has not enough main memory download the extract from development host and continue with OSM section.)
2023-03-06 22:13:08 +01:00
```
2023-03-09 15:01:31 +01:00
cd
2023-03-07 14:20:07 +01:00
mkdir <target folder>
java -Xms20G -server -jar onebusaway-gtfs-transformer-cl-<version>.jar --transform=./connect-ls-top-dhid-retain-bsag.txt connect-ls-top-dhid.zip <target folder>
2023-03-06 22:13:08 +01:00
```
* archive GTFS extract
```
2023-03-09 15:01:31 +01:00
(cd bsag/ && zip -r ../connect-ls-top-dhid-retain-bsag.gtfs.zip .)
mv ../connect-ls-top-dhid-retain-bsag.gtfs.zip ./otp
2023-03-06 22:13:08 +01:00
```
# OSM source file
* download osm extract for lower saxony
```
2023-03-09 15:01:31 +01:00
cd
2023-03-06 22:13:08 +01:00
mkdir osm && cd osm
rm wget-log-niedersachsen
rm niedersachsen.osm.pbf
wget -o ./wget-log-niedersachsen -O niedersachsen-latest.osm.pbf http://download.geofabrik.de/europe/germany/niedersachsen-latest.osm.pbf
```
* get bounding box as CSV from [here](https://boundingbox.klokantech.com/)
```
8.415555,52.893073,9.034566,53.269949
```
2023-03-09 15:01:31 +01:00
* install osmconvert
```
sudo apt update
sudo apt install osmctools --no-install-recommends
```
2023-03-06 22:13:08 +01:00
* generate OSM extract for bsag
```
2023-03-09 15:01:31 +01:00
cd ~/osm
osmconvert <input file name>.pbf -b=8.415555,52.893073,9.034566,53.269949 --complete-ways -o=<output file name>.pbf
cd
mkdir -p ~/otp
mv ~/osm/<output file name>.pbf ~/otp/
```
# Prepare otp
* build otp on development host and copy on server host or download otp
ATTENTION: Otp can be downloaded from here:
https://github.com/opentripplanner/OpenTripPlanner/releases/
https://repo1.maven.org/maven2/org/opentripplanner/otp/
```
cd ~/otp
mv ~/connect-ls-top-dhid-retain-bsag.gtfs.zip ~/otp/
sudo update-alternatives --config java
```
# Build street graph
* save the graph
```
cd ~/otp
java -Xmx2G -jar otp-2.2.0-shaded.jar --buildStreet .
```
# Build a graph layering transit data on top of the saved street graph
```
cd ~/otp
java -Xmx2G -jar otp-2.2.0-shaded.jar --loadStreet --save .
```
# Configure otp
* configure graph build in file build-config.json like this
```
{
"graph":"file:///home/otp/otp-2.3.0/graph-${otp.serialization.version.id}.obj",
"configVersion":"v0.0.1",
"osmDefaults": {
"osmTagMapping": "default",
"timeZone": "Europe/Berlin"
}
}
```
* configure routing in file router-config.json like this
```
{
"updaters": [
{
"type" : "real-time-alerts",
"frequencySec" : 60,
"url" : "http://gtfsr.vbn.de/gtfsr_connect.bin",
"feedId" : "VBN"
},
{
"type" : "stop-time-updater",
"frequencySec" : 60,
"backwardsDelayPropagationType" : "REQUIRED_NO_DATA",
"url" : "http://gtfsr.vbn.de/gtfsr_connect.bin",
"feedId" : "VBN"
}
],
"configVersion":"v0.0.1"
}
```
* configure otp in general in file otp-config.json like this
```
{
"otpFeatures" : {
"SandboxAPILegacyGraphQLApi": true
}
}
2023-03-06 22:13:08 +01:00
```
2023-03-09 15:01:31 +01:00
# Start otp
```
cd ~/otp
java -Xmx2G -jar otp-2.2.0-shaded.jar --load .
2023-03-06 22:13:08 +01:00
```