#!/bin/bash O5MTOOLSDIR=/home/osm/o5mtools PLANETDIR=/home/osm/planet MKGMAPDIR=/home/osm/mkgmap MKGMAPLIBS=${MKGMAPDIR}/lib/fastutil-6.5.2-mkg.1.jar:${MKGMAPDIR}/lib/osmpbf-1.1.1-754a33af.jar:${MKGMAPDIR}/lib/protobuf-java-2.4.1.jar YESTERDAY=`date -d "yesterday" +%Y%m%d` TODAY=`date +%Y%m%d` # update the planet ${O5MTOOLSDIR}/osmupdate -v --day --drop-author --keep-tempfiles ${PLANETDIR}/${YESTERDAY}/planet.o5m ${PLANETDIR}/${TODAY}/planet.o5m # extract the bounds data from the planet ${O5MTOOLSDIR}/osmfilter ${PLANETDIR}/${TODAY}/planet.osm.o5m --keep-nodes= --keep-ways-relations="boundary=administrative =postal_code postal_code=" --drop-tags="created_by= source= building= highway= maxspeed= surface= oneway= note= natural= lit=" -o=${PLANETDIR}/${TODAY}/bounds_data.o5m # compile the mkgmap bounds files java -Xmx8g -cp ${MKGMAPDIR}/mkgmap.jar:${MKGMAPLIBS} uk.me.parabola.mkgmap.reader.osm.boundary.BoundaryPreprocessor ${PLANETDIR}/${TODAY}/bounds_data.o5m ${PLANETDIR}/${TODAY}/bounds # someone asked for a timestamp within the bounds.zip file # so pipe the current date to file named version.txt echo ${TODAY} > ${PLANETDIR}/${TODAY}/bounds/version.txt cd ${PLANETDIR}/${TODAY} # zip the files zip bounds_${TODAY}.zip bounds