3 # Script to delete tiles that only contain water (usually in the
4 # middle of an ocean) in the higher numbered zoomlevels. These
5 # are trivial to regenerate (far less than one second) at any
9 # Minimum Zoom in which we delete
12 # Maximum Zoom in which we delete
15 # Age in days after which we delete
18 # the md5sum of a metatile containing only water?
19 MD5OSMDE="c6501cefd852a2c5b16f297948ca309c"
20 MD5OSMORG="9d7ceeb7ab3a0905abf200f1a7608f92"
22 # the size of a metatile containing only water?
26 # Directory that contains the tiles? (with trailing slash!)
27 OSMDEDIR="/mnt/tiles/tiles/osmde/"
28 OSMORGDIR="/mnt/tiles/tiles/osm/"
31 for z in `seq $MINZ $MAXZ`
33 if [ ! -d "${OSMDEDIR}${z}" ] ; then
36 for tiles in `find ${OSMDEDIR}${z} -xdev -type f -name '*.meta' -size ${SIZEOSMDE}c -mtime +${AGE} -print`
38 # We need to skip the first 20 bytes of the file as they contain the metafile
39 # header that contains the x/y location of the tile.
40 TILEMD5=`tail -c +20 $tiles | md5sum -b | sed -e 's/ .*//g'`
41 if [ "$TILEMD5" == "$MD5OSMDE" ] ; then
42 echo "Deleting $tiles"
44 if [ $? -ne 0 ] ; then
45 echo "There was an error deleting $tiles."
46 echo "Aborting after deleting $NDELETED files."
49 let "NDELETED=NDELETED+1"
51 # echo "$tiles is not a water tile."
56 for z in `seq $MINZ $MAXZ`
58 if [ ! -d "${OSMORGDIR}${z}" ] ; then
61 for tiles in `find ${OSMORGDIR}${z} -xdev -type f -name '*.meta' -size ${SIZEOSMORG}c -mtime +${AGE} -print`
63 # We need to skip the first 20 bytes of the file as they contain the metafile
64 # header that contains the x/y location of the tile.
65 TILEMD5=`tail -c +20 $tiles | md5sum -b | sed -e 's/ .*//g'`
66 if [ "$TILEMD5" == "$MD5OSMORG" ] ; then
67 echo "Deleting $tiles"
69 if [ $? -ne 0 ] ; then
70 echo "There was an error deleting $tiles."
71 echo "Aborting after deleting $NDELETED files."
74 let "NDELETED=NDELETED+1"
76 # echo "$tiles is not a water tile."
81 echo "$NDELETED files deleted."