aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts/osm/osm.pbf.update
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/osm/osm.pbf.update')
-rwxr-xr-xscripts/osm/osm.pbf.update3
1 files changed, 3 insertions, 0 deletions
diff --git a/scripts/osm/osm.pbf.update b/scripts/osm/osm.pbf.update
index 117276c..cd115a7 100755
--- a/scripts/osm/osm.pbf.update
+++ b/scripts/osm/osm.pbf.update
@@ -7,11 +7,13 @@ PBF_FILE=$1
7echo Fetching the latest sequence number 7echo Fetching the latest sequence number
8LATEST_SEQ=$(curl --silent http://download.geofabrik.de/asia/taiwan-updates/state.txt |\ 8LATEST_SEQ=$(curl --silent http://download.geofabrik.de/asia/taiwan-updates/state.txt |\
9 tail -1 | cut -d'=' -f2) 9 tail -1 | cut -d'=' -f2)
10echo Latest sequence number is $LATEST_SEQ
10 11
11# get current sequence number 12# get current sequence number
12SEQ=$(osmium fileinfo $PBF_FILE |\ 13SEQ=$(osmium fileinfo $PBF_FILE |\
13 grep osmosis_replication_sequence_number |\ 14 grep osmosis_replication_sequence_number |\
14 cut -d'=' -f2) 15 cut -d'=' -f2)
16echo File sequence number is $SEQ
15 17
16# while server has osc file with given sequence number, 18# while server has osc file with given sequence number,
17# get it and do file update 19# get it and do file update
@@ -20,6 +22,7 @@ while
20 [ $SEQ -le $LATEST_SEQ ] 22 [ $SEQ -le $LATEST_SEQ ]
21do 23do
22 mkdir -p changes 24 mkdir -p changes
25 SEQ_PATH=$(echo $SEQ | sed -r 's/(.{1})(.{3})/00\1\/\2/')
23 CHANGE_URL=$GEOFABRICK_SERVER/000/$SEQ_PATH.osc.gz 26 CHANGE_URL=$GEOFABRICK_SERVER/000/$SEQ_PATH.osc.gz
24 echo $CHANGE_URL 27 echo $CHANGE_URL
25 curl -o changes/$SEQ.osc.gz $CHANGE_URL && \ 28 curl -o changes/$SEQ.osc.gz $CHANGE_URL && \