From 68d4a9caf4c9267976452ad098d29f6522482cc6 Mon Sep 17 00:00:00 2001 From: Jochen Topf Date: Mon, 27 May 2013 15:27:26 +0200 Subject: Make minimum number of tags/relations of some type needed for some statistics configurable. --- sources/master/interesting_relation_types.sql | 3 ++- sources/master/interesting_tags.sql | 5 +++-- sources/master/update.sh | 6 ++++-- 3 files changed, 9 insertions(+), 5 deletions(-) (limited to 'sources/master') diff --git a/sources/master/interesting_relation_types.sql b/sources/master/interesting_relation_types.sql index 18aab2d..e2e7954 100644 --- a/sources/master/interesting_relation_types.sql +++ b/sources/master/interesting_relation_types.sql @@ -17,8 +17,9 @@ CREATE TABLE interesting_relation_types ( rtype TEXT ); +-- MIN_COUNT_RELATIONS_PER_TYPE setting: sources.master.min_count_relations_per_type INSERT INTO interesting_relation_types (rtype) - SELECT value FROM db.tags WHERE key='type' AND count_relations > 100; + SELECT value FROM db.tags WHERE key='type' AND count_relations > __MIN_COUNT_RELATIONS_PER_TYPE__; ANALYZE interesting_relation_types; diff --git a/sources/master/interesting_tags.sql b/sources/master/interesting_tags.sql index 160e1fb..406b525 100644 --- a/sources/master/interesting_tags.sql +++ b/sources/master/interesting_tags.sql @@ -21,10 +21,11 @@ CREATE TABLE interesting_tags ( value TEXT ); +-- MIN_COUNT_TAGS setting: sources.master.min_count_tags INSERT INTO interesting_tags (key, value) - SELECT DISTINCT key, NULL FROM db.keys WHERE count_all > 10000 + SELECT DISTINCT key, NULL FROM db.keys WHERE count_all > __MIN_COUNT_TAGS__ UNION - SELECT key, value FROM db.tags WHERE count_all > 10000; + SELECT key, value FROM db.tags WHERE count_all > __MIN_COUNT_TAGS__; DELETE FROM interesting_tags WHERE key IN ('created_by', 'ele', 'height', 'is_in', 'lanes', 'layer', 'maxspeed', 'name', 'ref', 'width') AND value IS NOT NULL; DELETE FROM interesting_tags WHERE value IS NOT NULL AND key LIKE '%:%'; diff --git a/sources/master/update.sh b/sources/master/update.sh index d030134..63814a1 100755 --- a/sources/master/update.sh +++ b/sources/master/update.sh @@ -35,10 +35,12 @@ $EXEC_RUBY -pe "\$_.sub!(/__DIR__/, '$DIR')" search.sql | sqlite3 $DIR/taginfo-s rm -f $DATABASE echo "`$DATECMD` Create master database..." +min_count_tags=`../../bin/taginfo-config.rb sources.master.min_count_tags 10000` +min_count_relations_per_type=`../../bin/taginfo-config.rb sources.master.min_count_relations_per_type 100` sqlite3 $DATABASE