summaryrefslogtreecommitdiff
path: root/sources/db/update.sh
diff options
context:
space:
mode:
authorJochen Topf <jochen@topf.org>2010-10-04 18:41:53 +0200
committerJochen Topf <jochen@topf.org>2010-10-04 18:41:53 +0200
commit9918c2c4c266a29848ce39fe2496876c66c3a48e (patch)
treeb49fe450d33dcb3c30b37f7bff68fbb475ecec66 /sources/db/update.sh
downloadtaginfo-9918c2c4c266a29848ce39fe2496876c66c3a48e.tar
taginfo-9918c2c4c266a29848ce39fe2496876c66c3a48e.tar.gz
first commit
Diffstat (limited to 'sources/db/update.sh')
-rwxr-xr-xsources/db/update.sh37
1 files changed, 37 insertions, 0 deletions
diff --git a/sources/db/update.sh b/sources/db/update.sh
new file mode 100755
index 0000000..3a48e74
--- /dev/null
+++ b/sources/db/update.sh
@@ -0,0 +1,37 @@
+#!/bin/sh
+#
+# Taginfo source: DB
+#
+# update.sh DIR
+#
+
+set -e
+
+DIR=$1
+
+if [ "x" = "x$DIR" ]; then
+ echo "Usage: update.sh DIR"
+ exit 1
+fi
+
+echo -n "Start db: "; date
+
+DATABASE=$DIR/taginfo-db.db
+
+rm -f $DATABASE
+rm -f $DIR/count.db
+
+echo "Running pre.sql..."
+sqlite3 $DATABASE <pre.sql
+
+echo "Running count..."
+HERE=`pwd`
+cd $DIR
+bzcat $DIR/planet.osm.bz2 | $HERE/osmium_tagstats -
+cd $HERE
+
+echo "Running post.sql..."
+perl -pe "s|__DIR__|$DIR|" post.sql | sqlite3 $DATABASE
+
+echo -n "Done db: "; date
+