From: User for running Openstreetmap-things Date: Wed, 9 Sep 2015 10:01:24 +0000 (+0200) Subject: add support for hd tiles, cleanup. X-Git-Url: http://git.rrze.uni-erlangen.de/gitweb/?a=commitdiff_plain;h=f591210a88ea21c72a4ebcfb98e8e16673da99f5;p=osmrrze.git add support for hd tiles, cleanup. --- diff --git a/scripts/deleteseatiles.sh b/scripts/deleteseatiles.sh index d7eada6..3775df4 100755 --- a/scripts/deleteseatiles.sh +++ b/scripts/deleteseatiles.sh @@ -7,7 +7,7 @@ # Some settings # Minimum Zoom in which we delete -MINZ=11 +MINZ=10 # Maximum Zoom in which we delete MAXZ=20 @@ -15,66 +15,51 @@ MAXZ=20 # Age in days after which we delete AGE=3 +declare -A TMD5 # the md5sum of a metatile containing only water? -MD5OSMDE="c6501cefd852a2c5b16f297948ca309c" -MD5OSMORG="9d7ceeb7ab3a0905abf200f1a7608f92" +TMD5[osmde]="c6501cefd852a2c5b16f297948ca309c" +TMD5[osmorg]="9d7ceeb7ab3a0905abf200f1a7608f92" +TMD5[osmhd]="d47bd18df80dbefb2f89b81a672cae92" +declare -A TSIZE # the size of a metatile containing only water? -SIZEOSMDE=7124 -SIZEOSMORG=7124 +TSIZE[osmde]=7124 +TSIZE[osmorg]=7124 +TSIZE[osmhd]=8596 +declare -A TDIR # Directory that contains the tiles? (with trailing slash!) -OSMDEDIR="/mnt/tiles/tiles/osmde/" -OSMORGDIR="/mnt/tiles/tiles/osm/" +TDIR[osmde]="/mnt/tiles/tiles/osmde/" +TDIR[osmorg]="/mnt/tiles/tiles/osm/" +TDIR[osmhd]="/mnt/tiles/tiles/osmhd/" NDELETED=0 -for z in `seq $MINZ $MAXZ` +for style in "osmde" "osmorg" "osmhd" do - if [ ! -d "${OSMDEDIR}${z}" ] ; then - continue - fi - for tiles in `find ${OSMDEDIR}${z} -xdev -type f -name '*.meta' -size ${SIZEOSMDE}c -mtime +${AGE} -print` + echo "Handling style: $style - looking for files with size ${TSIZE[$style]} and md5sum ${TMD5[$style]} in ${TDIR[$style]}" + for z in `seq $MINZ $MAXZ` do - # We need to skip the first 20 bytes of the file as they contain the metafile - # header that contains the x/y location of the tile. - TILEMD5=`tail -c +20 $tiles | md5sum -b | sed -e 's/ .*//g'` - if [ "$TILEMD5" == "$MD5OSMDE" ] ; then - echo "Deleting $tiles" - rm $tiles - if [ $? -ne 0 ] ; then - echo "There was an error deleting $tiles." - echo "Aborting after deleting $NDELETED files." - exit 1 - fi - let "NDELETED=NDELETED+1" - #else - # echo "$tiles is not a water tile." + if [ ! -d "${TDIR[$style]}${z}" ] ; then + continue fi - done -done - -for z in `seq $MINZ $MAXZ` -do - if [ ! -d "${OSMORGDIR}${z}" ] ; then - continue - fi - for tiles in `find ${OSMORGDIR}${z} -xdev -type f -name '*.meta' -size ${SIZEOSMORG}c -mtime +${AGE} -print` - do - # We need to skip the first 20 bytes of the file as they contain the metafile - # header that contains the x/y location of the tile. - TILEMD5=`tail -c +20 $tiles | md5sum -b | sed -e 's/ .*//g'` - if [ "$TILEMD5" == "$MD5OSMORG" ] ; then - echo "Deleting $tiles" - #rm $tiles - if [ $? -ne 0 ] ; then - echo "There was an error deleting $tiles." - echo "Aborting after deleting $NDELETED files." - exit 1 + for tiles in `find ${TDIR[$style]}${z} -xdev -type f -name '*.meta' -size ${TSIZE[$style]}c -mtime +${AGE} -print` + do + # We need to skip the first 20 bytes of the file as they contain the metafile + # header that contains the x/y location of the tile. + TILEMD5=`tail -c +20 $tiles | md5sum -b | sed -e 's/ .*//g'` + if [ "$TILEMD5" == "${TMD5[$style]}" ] ; then + echo "Deleting $tiles" + rm $tiles + if [ $? -ne 0 ] ; then + echo "There was an error deleting $tiles." + echo "Aborting after deleting $NDELETED files." + exit 1 + fi + let "NDELETED=NDELETED+1" + #else + # echo "$tiles is not a water tile." fi - let "NDELETED=NDELETED+1" - #else - # echo "$tiles is not a water tile." - fi + done done done