diff options
author | typebrook <typebrook@gmail.com> | 2020-02-27 16:32:37 +0800 |
---|---|---|
committer | typebrook <typebrook@gmail.com> | 2020-02-27 16:32:37 +0800 |
commit | 00b136155183ae522ca458e540a8cf29bf525e74 (patch) | |
tree | c6e9d20d5021c95afc7149456d57eb435d808150 /scripts/osm/osm.pbf.update | |
parent | 3fa79eb14a4c0244fb2dc4a5b805b7cffaa63770 (diff) |
update
Diffstat (limited to 'scripts/osm/osm.pbf.update')
-rwxr-xr-x | scripts/osm/osm.pbf.update | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/scripts/osm/osm.pbf.update b/scripts/osm/osm.pbf.update deleted file mode 100755 index cd115a7..0000000 --- a/scripts/osm/osm.pbf.update +++ /dev/null | |||
@@ -1,39 +0,0 @@ | |||
1 | #!/bin/bash | ||
2 | |||
3 | GEOFABRICK_SERVER=http://download.geofabrik.de/asia/taiwan-updates | ||
4 | PBF_FILE=$1 | ||
5 | |||
6 | # get latest sequence number | ||
7 | echo Fetching the latest sequence number | ||
8 | LATEST_SEQ=$(curl --silent http://download.geofabrik.de/asia/taiwan-updates/state.txt |\ | ||
9 | tail -1 | cut -d'=' -f2) | ||
10 | echo Latest sequence number is $LATEST_SEQ | ||
11 | |||
12 | # get current sequence number | ||
13 | SEQ=$(osmium fileinfo $PBF_FILE |\ | ||
14 | grep osmosis_replication_sequence_number |\ | ||
15 | cut -d'=' -f2) | ||
16 | echo File sequence number is $SEQ | ||
17 | |||
18 | # while server has osc file with given sequence number, | ||
19 | # get it and do file update | ||
20 | while | ||
21 | (( SEQ++ )) | ||
22 | [ $SEQ -le $LATEST_SEQ ] | ||
23 | do | ||
24 | mkdir -p changes | ||
25 | SEQ_PATH=$(echo $SEQ | sed -r 's/(.{1})(.{3})/00\1\/\2/') | ||
26 | CHANGE_URL=$GEOFABRICK_SERVER/000/$SEQ_PATH.osc.gz | ||
27 | echo $CHANGE_URL | ||
28 | curl -o changes/$SEQ.osc.gz $CHANGE_URL && \ | ||
29 | osmium apply-changes $PBF_FILE changes/$SEQ.osc.gz \ | ||
30 | --output-header=osmosis_replication_sequence_number=$SEQ \ | ||
31 | --overwrite \ | ||
32 | --output $SEQ.osm.pbf | ||
33 | |||
34 | mv $PBF_FILE $((SEQ-1)).osm.pbf | ||
35 | mv $SEQ.osm.pbf $PBF_FILE | ||
36 | done | ||
37 | |||
38 | echo | ||
39 | echo File sequence number is $((SEQ-1)), already the latest one on Geofrbrik | ||