-
Notifications
You must be signed in to change notification settings - Fork 8
/
build-graph.sh
executable file
·65 lines (51 loc) · 2.05 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#!/bin/bash -e
# SPDX-FileCopyrightText: NOI Techpark <[email protected]>
#
# SPDX-License-Identifier: CC0-1.0
source .otp-version
CURL="curl --location --fail --show-error -#"
# 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
# transit data
TRANSIT_NETEX_URL="ftp://ftp01.sta.bz.it/netex/$(date +%Y)/plan/EU_Profil/NX-PI_01_it_apb_LINE_apb__$(date +%Y%m%d).xml.zip"
TRANSIT_NETEX_ZIP=data/sta-netex.xml.zip
# parking
PARKING_NETEX_URL=https://transmodel.api.opendatahub.com/netex/parking
PARKING_NETEX_XML=data/shared-data.xml
PARKING_NETEX_ZIP=data/parking-netex.xml.zip
# when on github actions then install the required tools
if [ -n "${CI+isset}" ]; then
sudo apt-get -qq install osmium-tool pyosmium wget zip
fi
mkdir -p data
if [ ! -f "${NORTH_EAST_PBF}" ]; then
echo "Downloading OSM data for NE Italy from ${NORTH_EAST_URL}"
${CURL} ${NORTH_EAST_URL} -o ${NORTH_EAST_PBF}
else
echo "Checking for updates for existing OSM file"
pyosmium-up-to-date ${NORTH_EAST_PBF}
fi
# cut out South Tyrol from the large North East Italy extract
echo "Extracting ${SOUTH_TYROL_PBF} from ${NORTH_EAST_PBF}"
osmium extract ${NORTH_EAST_PBF} --polygon south-tyrol.geojson -o ${SOUTH_TYROL_PBF} --overwrite
if [ ! -f "${ELEVATION_ZIP}" ]; then
${CURL} ${ELEVATION_URL} -o ${ELEVATION_ZIP}
unzip -o ${ELEVATION_ZIP} -d data
fi
#echo "Downloading NeTEx transit data from ${TRANSIT_NETEX_URL}"
#${CURL} "${TRANSIT_NETEX_URL}" -o ${TRANSIT_NETEX_ZIP}
# download parking data and put it into a zip
rm -f ${PARKING_NETEX_XML} ${PARKING_NETEX_ZIP}
${CURL} ${PARKING_NETEX_URL} -o ${PARKING_NETEX_XML}
zip --junk-paths ${PARKING_NETEX_ZIP} ${PARKING_NETEX_XML}
# actually do graph build
docker run \
-v .:/var/opentripplanner/:z \
--rm \
-e JAVA_TOOL_OPTIONS="-Xmx6G" \
"${OTP_IMAGE}" --abortOnUnknownConfig --build --save