]> git.openstreetmap.org Git - chef.git/blob - cookbooks/taginfo/templates/default/update-planet.erb
8fd69ff9e9d9ace6b9e5914b2e0c04e2820998d1
[chef.git] / cookbooks / taginfo / templates / default / update-planet.erb
1 #!/bin/sh
2
3 set -e
4
5 cd "<%= @directory %>/planet"
6
7 OSCFILE="$(date +%Y%m%d-%H%M).osc"
8
9 # if there are old .osc files, they have to be taken into account
10
11 OLDFILE=2*-*.osc
12 if [ -z "$OLDFILE" ]
13 then
14    osmosis --rri --simc --write-xml-change "$OSCFILE"
15 else
16    osmosis --rxc "$OLDFILE" --rri --mc --simc --write-xml-change "$OSCFILE" && rm "$OLDFILE"
17 fi
18
19 # osc file is ready, create new planet file
20
21 osmosis --read-xml-change "$OSCFILE" --read-bin planet.pbf --buffer bufferCapacity=12000 --apply-change --buffer bufferCapacity=12000 --write-pbf planet-new.pbf
22
23 # cleanup
24
25 mv planet-new.pbf planet.pbf
26 rm "$OSCFILE"