new in the overlay: draw bus stops and show which bus lines depart from there.
[osmrrze.git] / scripts / deleteseatiles.sh
CommitLineData
cc9b12f0
UO
1#!/bin/bash
2
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
6# time.
7
8# Some settings
9# Minimum Zoom in which we delete
10MINZ=11
11
12# Maximum Zoom in which we delete
13MAXZ=20
14
15# Age in days after which we delete
16AGE=3
17
18# the md5sum of a metatile containing only water?
19MD5OSMDE="c6501cefd852a2c5b16f297948ca309c"
20MD5OSMORG="9d7ceeb7ab3a0905abf200f1a7608f92"
21
22# the size of a metatile containing only water?
23SIZEOSMDE=7124
24SIZEOSMORG=7124
25
26# Directory that contains the tiles? (with trailing slash!)
27OSMDEDIR="/mnt/tiles/tiles/osmde/"
28OSMORGDIR="/mnt/tiles/tiles/osm/"
29
30NDELETED=0
31for z in `seq $MINZ $MAXZ`
32do
33 if [ ! -d "${OSMDEDIR}${z}" ] ; then
34 continue
35 fi
36 for tiles in `find ${OSMDEDIR}${z} -xdev -type f -name '*.meta' -size ${SIZEOSMDE}c -mtime +${AGE} -print`
37 do
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"
43 rm $tiles
44 if [ $? -ne 0 ] ; then
45 echo "There was an error deleting $tiles."
46 echo "Aborting after deleting $NDELETED files."
47 exit 1
48 fi
49 let "NDELETED=NDELETED+1"
50 #else
51 # echo "$tiles is not a water tile."
52 fi
53 done
54done
55
56for z in `seq $MINZ $MAXZ`
57do
58 if [ ! -d "${OSMORGDIR}${z}" ] ; then
59 continue
60 fi
61 for tiles in `find ${OSMORGDIR}${z} -xdev -type f -name '*.meta' -size ${SIZEOSMORG}c -mtime +${AGE} -print`
62 do
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"
68 #rm $tiles
69 if [ $? -ne 0 ] ; then
70 echo "There was an error deleting $tiles."
71 echo "Aborting after deleting $NDELETED files."
72 exit 1
73 fi
74 let "NDELETED=NDELETED+1"
75 #else
76 # echo "$tiles is not a water tile."
77 fi
78 done
79done
80
81echo "$NDELETED files deleted."
82
This page took 0.049551 seconds and 4 git commands to generate.