diff options
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 | ||