diff options
author | Jochen Topf <jochen@topf.org> | 2013-05-27 15:27:26 +0200 |
---|---|---|
committer | Jochen Topf <jochen@topf.org> | 2013-05-27 15:27:26 +0200 |
commit | 68d4a9caf4c9267976452ad098d29f6522482cc6 (patch) | |
tree | 9b01d59a0e12e2edca1cbc1e01008f9b9cb22d2f | |
parent | c456c0df0fefd5b8585fce4c12baecbe66b50b34 (diff) | |
download | taginfo-68d4a9caf4c9267976452ad098d29f6522482cc6.tar taginfo-68d4a9caf4c9267976452ad098d29f6522482cc6.tar.gz |
Make minimum number of tags/relations of some type needed for some statistics configurable.
-rwxr-xr-x | bin/taginfo-config.rb | 4 | ||||
-rw-r--r-- | sources/master/interesting_relation_types.sql | 3 | ||||
-rw-r--r-- | sources/master/interesting_tags.sql | 5 | ||||
-rwxr-xr-x | sources/master/update.sh | 6 | ||||
-rw-r--r-- | taginfo-config-example.json | 10 |
5 files changed, 21 insertions, 7 deletions
diff --git a/bin/taginfo-config.rb b/bin/taginfo-config.rb index fbeb163..96d8a43 100755 --- a/bin/taginfo-config.rb +++ b/bin/taginfo-config.rb @@ -1,6 +1,6 @@ #!/usr/bin/ruby # -# taginfo-config.rb [KEY] +# taginfo-config.rb KEY [DEFAULT] # require 'rubygems' @@ -10,7 +10,7 @@ require File.expand_path(File.dirname(__FILE__)) + '/../web/lib/config.rb' TaginfoConfig.read -value = TaginfoConfig.get(ARGV[0]) +value = TaginfoConfig.get(ARGV[0], ARGV[1]) if value.nil? puts '' exit 1 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 <languages.sql $EXEC_RUBY -pe "\$_.sub!(/__DIR__/, '$DIR')" master.sql | sqlite3 $DATABASE -$EXEC_RUBY -pe "\$_.sub!(/__DIR__/, '$DIR')" interesting_tags.sql | sqlite3 $DATABASE -$EXEC_RUBY -pe "\$_.sub!(/__DIR__/, '$DIR')" interesting_relation_types.sql | sqlite3 $DATABASE +$EXEC_RUBY -pe "\$_.sub!(/__DIR__/, '$DIR').sub!(/__MIN_COUNT_TAGS__/, '$min_count_tags')" interesting_tags.sql | sqlite3 $DATABASE +$EXEC_RUBY -pe "\$_.sub!(/__DIR__/, '$DIR').sub!(/__MIN_COUNT_RELATIONS_PER_TYPE__/, '$min_count_relations_per_type')" interesting_relation_types.sql | sqlite3 $DATABASE echo "`$DATECMD` Updating history database..." if [ ! -e $HISTORYDB ]; then diff --git a/taginfo-config-example.json b/taginfo-config-example.json index fab2cb7..9795904 100644 --- a/taginfo-config-example.json +++ b/taginfo-config-example.json @@ -58,6 +58,16 @@ "tagstats": "./tagstats", // The OSM planet file or extract where we read the OSM data from. "planetfile": "/osm/planet/var/current-planet.osm.pbf" + }, + "master": { + // Minimum number of occurances of a tag to make it + // potentially "interesting", ie. create tag combination + // statistics for it. + "min_count_tags": 10000, + // Minimum number of relations per type to make this + // relation type "interesting", ie. to make it show + // up as a relation type. + "min_count_relations_per_type": 100 } }, "logging": { |