Created
September 12, 2017 20:09
-
-
Save ramunasd/c8152ac6d8e693cb9059e444df45096b to your computer and use it in GitHub Desktop.
OSM data file update script
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
DATAFILE=${DATAFILE:=data.pbf} | |
echo "----------" | |
echo "Update started: `date +%c`" | |
# update | |
rm change.osc.gz | |
./osmupdate $DATAFILE change.osc.gz > ./log | |
if [ ! -s change.osc.gz ]; then | |
echo "Failed to update data" | |
exit | |
fi | |
# apply & clip | |
./osmconvert $DATAFILE change.osc.gz -B=bounds.poly --complete-ways --complex-ways --out-o5m > temp.o5m | |
./osmconvert $DATAFILE temp.o5m --diff > change.osc | |
#apply diff | |
rm dirty_tiles | |
./osm2pgsql -d baltic -S osm2pgsql.style -s -C 100 -e 12-19 -a change.osc >/dev/null | |
if [ $? -ne 0 ]; then | |
exit | |
fi | |
./osmconvert temp.o5m --out-pbf > temp.pbf && \ | |
mv temp.pbf data.pbf | |
if [ $? -ne 0 ]; then | |
exit | |
fi | |
rm temp.o5m | |
md5sum $DATAFILE > $DATAFILE.md5 | |
date +%s > /var/www/tiles/osm_lt/last-update-complete | |
# render expired | |
if [ -s dirty_tiles ]; then | |
./render_expired -m osm_lt -s /run/renderd/mod_tile2.sock -l 2 -z 13 -Z 19 -T 15 < dirty_tiles | tail -n 8 | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment