diff options
| author | typebrook <typebrook@gmail.com> | 2019-11-27 09:55:12 +0800 |
|---|---|---|
| committer | typebrook <typebrook@gmail.com> | 2019-11-27 11:32:00 +0800 |
| commit | 466c5a67eb9f401a498315e793ce99da22fa98b6 (patch) | |
| tree | f4df701dad0401001ca160f5cc2b5869d4abab27 | |
| parent | 48e72e99b5085f03b98cfe096a07442bd8d03dce (diff) | |
update
| -rwxr-xr-x | scripts/osm/osm.pbf.update | 3 |
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 | |||
| 7 | echo Fetching the latest sequence number | 7 | echo Fetching the latest sequence number |
| 8 | LATEST_SEQ=$(curl --silent http://download.geofabrik.de/asia/taiwan-updates/state.txt |\ | 8 | LATEST_SEQ=$(curl --silent http://download.geofabrik.de/asia/taiwan-updates/state.txt |\ |
| 9 | tail -1 | cut -d'=' -f2) | 9 | tail -1 | cut -d'=' -f2) |
| 10 | echo Latest sequence number is $LATEST_SEQ | ||
| 10 | 11 | ||
| 11 | # get current sequence number | 12 | # get current sequence number |
| 12 | SEQ=$(osmium fileinfo $PBF_FILE |\ | 13 | SEQ=$(osmium fileinfo $PBF_FILE |\ |
| 13 | grep osmosis_replication_sequence_number |\ | 14 | grep osmosis_replication_sequence_number |\ |
| 14 | cut -d'=' -f2) | 15 | cut -d'=' -f2) |
| 16 | echo 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 ] |
| 21 | do | 23 | do |
| 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 && \ |