einfaches script um sea-tiles (also tiles die nur "blau" sind weil sie komplett im...
authorUser for running Openstreetmap-things <osm@osm.rrze.uni-erlangen.de>
Fri, 12 Sep 2014 11:42:29 +0000 (13:42 +0200)
committerUser for running Openstreetmap-things <osm@osm.rrze.uni-erlangen.de>
Fri, 12 Sep 2014 11:42:29 +0000 (13:42 +0200)
scripts/deleteseatiles.sh [new file with mode: 0755]

diff --git a/scripts/deleteseatiles.sh b/scripts/deleteseatiles.sh
new file mode 100755 (executable)
index 0000000..d7eada6
--- /dev/null
@@ -0,0 +1,82 @@
+#!/bin/bash
+
+# Script to delete tiles that only contain water (usually in the
+# middle of an ocean) in the higher numbered zoomlevels. These
+# are trivial to regenerate (far less than one second) at any
+# time.
+
+# Some settings
+# Minimum Zoom in which we delete
+MINZ=11
+
+# Maximum Zoom in which we delete
+MAXZ=20
+
+# Age in days after which we delete
+AGE=3
+
+# the md5sum of a metatile containing only water?
+MD5OSMDE="c6501cefd852a2c5b16f297948ca309c"
+MD5OSMORG="9d7ceeb7ab3a0905abf200f1a7608f92"
+
+# the size of a metatile containing only water?
+SIZEOSMDE=7124
+SIZEOSMORG=7124
+
+# Directory that contains the tiles? (with trailing slash!)
+OSMDEDIR="/mnt/tiles/tiles/osmde/"
+OSMORGDIR="/mnt/tiles/tiles/osm/"
+
+NDELETED=0
+for z in `seq $MINZ $MAXZ`
+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`
+  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."
+    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
+      fi
+      let "NDELETED=NDELETED+1"
+    #else
+    #  echo "$tiles is not a water tile."
+    fi
+  done
+done
+
+echo "$NDELETED files deleted."
+
This page took 0.049545 seconds and 4 git commands to generate.