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
19 # the md5sum of a metatile containing only water?
20 TMD5[osmde]="c6501cefd852a2c5b16f297948ca309c"
21 TMD5[osmorg]="9d7ceeb7ab3a0905abf200f1a7608f92"
22 TMD5[osmhd]="d47bd18df80dbefb2f89b81a672cae92"
25 # the size of a metatile containing only water?
31 # Directory that contains the tiles? (with trailing slash!)
32 TDIR[osmde]="/mnt/tiles/tiles/osmde/"
33 TDIR[osmorg]="/mnt/tiles/tiles/osm/"
34 TDIR[osmhd]="/mnt/tiles/tiles/osmhd/"
37 for style in "osmde" "osmorg" "osmhd"
39 echo "Handling style: $style - looking for files with size ${TSIZE[$style]} and md5sum ${TMD5[$style]} in ${TDIR[$style]}"
40 for z in `seq $MINZ $MAXZ`
42 if [ ! -d "${TDIR[$style]}${z}" ] ; then
45 for tiles in `find ${TDIR[$style]}${z} -xdev -type f -name '*.meta' -size ${TSIZE[$style]}c -mtime +${AGE} -print`
47 # We need to skip the first 20 bytes of the file as they contain the metafile
48 # header that contains the x/y location of the tile.
49 TILEMD5=`tail -c +20 $tiles | md5sum -b | sed -e 's/ .*//g'`
50 if [ "$TILEMD5" == "${TMD5[$style]}" ] ; then
51 echo "Deleting $tiles"
53 if [ $? -ne 0 ] ; then
54 echo "There was an error deleting $tiles."
55 echo "Aborting after deleting $NDELETED files."
58 let "NDELETED=NDELETED+1"
60 # echo "$tiles is not a water tile."
66 echo "$NDELETED files deleted."