forked from noi-techpark/odh-mentor-otp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild-graph.sh
executable file
·45 lines (34 loc) · 1.19 KB
/
build-graph.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/bin/bash -e
# SPDX-FileCopyrightText: NOI Techpark <[email protected]>
#
# SPDX-License-Identifier: CC0-1.0
WGET="wget --progress=bar:force:noscroll"
# OSM
NORTH_EAST_URL=https://download.geofabrik.de/europe/italy/nord-est-latest.osm.pbf
NORTH_EAST_PBF=data/italy-nord-est.osm.pbf
SOUTH_TYROL_PBF=data/south-tyrol.osm.pbf
# elevation
ELEVATION_URL=https://srtm.csi.cgiar.org/wp-content/uploads/files/srtm_5x5/TIFF/srtm_39_03.zip
ELEVATION_ZIP=data/srtm_39_03.zip
# OTP
OTP_IMAGE=docker.io/opentripplanner/opentripplanner:2.5.0_2024-01-19T14-50
# when on github actions then install the required tools
if [ -n "${CI+isset}" ]; then
sudo apt-get -qq install osmium-tool wget
fi
mkdir -p data
if [ ! -f "${NORTH_EAST_PBF}" ]; then
${WGET} ${NORTH_EAST_URL} -O ${NORTH_EAST_PBF}
fi
# cut out South Tyrol from the large North East Italy extract
osmium extract ${NORTH_EAST_PBF} --polygon south-tyrol.geojson -o ${SOUTH_TYROL_PBF} --overwrite
if [ ! -f "${ELEVATION_ZIP}" ]; then
${WGET} ${ELEVATION_URL} -O ${ELEVATION_ZIP}
unzip -o ${ELEVATION_ZIP} -d data
fi
# actually do graph build
docker run \
-v .:/var/opentripplanner/:z \
--rm \
-e JAVA_TOOL_OPTIONS="-Xmx6G" \
${OTP_IMAGE} --build --save