From 3d269c3732d21566bd754d6a95f28909f0a41eec Mon Sep 17 00:00:00 2001 From: Leonard Ehrenfried Date: Mon, 5 Aug 2024 07:56:00 +0200 Subject: [PATCH 1/4] Add vector tile configuration --- infrastructure/docker/otp/Dockerfile | 2 +- otp-config.json | 5 ++ router-config.json | 68 ++++++++++++++++++++++++++++ 3 files changed, 74 insertions(+), 1 deletion(-) create mode 100644 otp-config.json diff --git a/infrastructure/docker/otp/Dockerfile b/infrastructure/docker/otp/Dockerfile index 30f7de89..5de080a8 100644 --- a/infrastructure/docker/otp/Dockerfile +++ b/infrastructure/docker/otp/Dockerfile @@ -3,7 +3,7 @@ FROM opentripplanner/opentripplanner:2.6.0_2024-08-01T06-53 WORKDIR /var/otp -ADD router-config.json /var/otp/ +ADD router-config.json otp-config.json /var/otp/ ADD graph.obj /var/otp/ ENTRYPOINT java $JAVA_OPTS -cp @/app/jib-classpath-file @/app/jib-main-class-file /var/otp/ --load --serve \ No newline at end of file diff --git a/otp-config.json b/otp-config.json new file mode 100644 index 00000000..13d46e34 --- /dev/null +++ b/otp-config.json @@ -0,0 +1,5 @@ +{ + "otpFeatures": { + "SandboxAPIMapboxVectorTilesApi": true + } +} \ No newline at end of file diff --git a/router-config.json b/router-config.json index d299c4db..ec67ab64 100644 --- a/router-config.json +++ b/router-config.json @@ -8,6 +8,74 @@ "maxWindow": "16h" } }, + "vectorTiles": { + "layers": [ + { + "name": "stops", + "type": "Stop", + "mapper": "Digitransit", + "maxZoom": 20, + "minZoom": 14, + "cacheMaxSeconds": 600 + }, + // flex zones + { + "name": "areaStops", + "type": "AreaStop", + "mapper": "OTPRR", + "maxZoom": 20, + "minZoom": 14, + "cacheMaxSeconds": 600 + }, + { + "name": "stations", + "type": "Station", + "mapper": "Digitransit", + "maxZoom": 20, + "minZoom": 12, + "cacheMaxSeconds": 600 + }, + // all rental places: stations and free-floating vehicles + { + "name": "citybikes", + "type": "VehicleRental", + "mapper": "Digitransit", + "maxZoom": 20, + "minZoom": 14, + "cacheMaxSeconds": 60, + "expansionFactor": 0.25 + }, + // just free-floating vehicles + { + "name": "rentalVehicles", + "type": "VehicleRentalVehicle", + "mapper": "DigitransitRealtime", + "maxZoom": 20, + "minZoom": 14, + "cacheMaxSeconds": 60 + }, + // just rental stations + { + "name": "rentalStations", + "type": "VehicleRentalStation", + "mapper": "Digitransit", + "maxZoom": 20, + "minZoom": 14, + "cacheMaxSeconds": 600 + }, + // no real-time, translatable fields are translated based on accept-language header + // and contains less fields than the Stadtnavi mapper + { + "name": "vehicleParking", + "type": "VehicleParking", + "mapper": "Digitransit", + "maxZoom": 20, + "minZoom": 14, + "cacheMaxSeconds": 600, + "expansionFactor": 0.25 + } + ] + }, "updaters": [ { "type": "stop-time-updater", From 342983b6d8c5e5acb482c40bb549ab7f066acbf8 Mon Sep 17 00:00:00 2001 From: Leonard Ehrenfried Date: Mon, 5 Aug 2024 07:59:29 +0200 Subject: [PATCH 2/4] Add workflow for building graph --- .github/workflows/pull-request.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 .github/workflows/pull-request.yml diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml new file mode 100644 index 00000000..018cde26 --- /dev/null +++ b/.github/workflows/pull-request.yml @@ -0,0 +1,13 @@ +name: Build graph + +on: + - pull_request + - push + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Checkout source code + uses: actions/checkout@v4 + - run: ./build-graph.sh From e1cf0d33f7fa280971a2bd217e94bcd35c69ecb1 Mon Sep 17 00:00:00 2001 From: Leonard Ehrenfried Date: Mon, 5 Aug 2024 08:03:00 +0200 Subject: [PATCH 3/4] Use WGET variable --- build-graph.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-graph.sh b/build-graph.sh index 600e2506..f5864bef 100755 --- a/build-graph.sh +++ b/build-graph.sh @@ -45,7 +45,7 @@ fi # download parking data and put it into a zip rm -f ${PARKING_NETEX_XML} ${PARKING_NETEX_ZIP} -wget ${PARKING_NETEX_URL} -O ${PARKING_NETEX_XML} +${WGET} ${PARKING_NETEX_URL} -O ${PARKING_NETEX_XML} zip --junk-paths ${PARKING_NETEX_ZIP} ${PARKING_NETEX_XML} From 6475f134e48b14235720df996f143b28c440e184 Mon Sep 17 00:00:00 2001 From: Leonard Ehrenfried Date: Mon, 5 Aug 2024 10:38:56 +0200 Subject: [PATCH 4/4] Don't cache OSM data anymore --- .github/workflows/main.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 5b161e1a..85997839 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -112,10 +112,8 @@ jobs: uses: actions/cache@v4 with: path: | - data/italy-nord-est.osm.pbf data/srtm* - key: input-data-${{ github.run_number }} - restore-keys: input-data + key: elevation - name: Build graph run: bash build-graph.sh