summaryrefslogtreecommitdiff
path: root/tagstats/tagstats.cpp
diff options
context:
space:
mode:
authorJochen Topf <jochen@topf.org>2013-10-07 18:36:15 +0200
committerJochen Topf <jochen@topf.org>2013-10-07 18:36:15 +0200
commita1d5747cfd8144da30b42054a6587377736a6ed3 (patch)
tree00efb5a00a5ca7116cbf38a41f31b81af9dbebbf /tagstats/tagstats.cpp
parentc16b94047a36a6738c6f95eb24deddf6519cd1af (diff)
downloadtaginfo-a1d5747cfd8144da30b42054a6587377736a6ed3.tar
taginfo-a1d5747cfd8144da30b42054a6587377736a6ed3.tar.gz
Make min_tag_combination_count configurable at runtime
Diffstat (limited to 'tagstats/tagstats.cpp')
-rw-r--r--tagstats/tagstats.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/tagstats/tagstats.cpp b/tagstats/tagstats.cpp
index 2dcbfb9..91b63ed 100644
--- a/tagstats/tagstats.cpp
+++ b/tagstats/tagstats.cpp
@@ -59,7 +59,9 @@ void print_help() {
<< "\nOptions:\n" \
<< " -H, --help This help message\n";
#ifdef TAGSTATS_COUNT_TAG_COMBINATIONS
- std::cout << " -T, --tags=FILENAME File with tags we are interested in\n";
+ std::cout << " -T, --tags=FILENAME File with tags we are interested in\n" \
+ << " -m, --min-tag-combination-count=N Tag combinations not appearing this often\n" \
+ << " are not written to database\n";
#endif // TAGSTATS_COUNT_TAG_COMBINATIONS
std::cout << " -R, --relation-types=FILENAME File with relation types we are interested in\n" \
<< " -t, --top=NUMBER Top of bounding box for distribution images\n" \
@@ -75,7 +77,8 @@ int main(int argc, char *argv[]) {
static struct option long_options[] = {
{"help", no_argument, 0, 'H'},
#ifdef TAGSTATS_COUNT_TAG_COMBINATIONS
- {"tags", required_argument, 0, 'T'},
+ {"tags", required_argument, 0, 'T'},
+ {"min-tag-combination-count", required_argument, 0, 'm'},
#endif // TAGSTATS_COUNT_TAG_COMBINATIONS
{"relation-types", required_argument, 0, 'R'},
{"top", required_argument, 0, 't'},
@@ -98,10 +101,12 @@ int main(int argc, char *argv[]) {
unsigned int width = 360;
unsigned int height = 180;
+ unsigned int min_tag_combination_count = 1000;
+
while (true) {
int c = getopt_long(argc, argv,
#ifdef TAGSTATS_COUNT_TAG_COMBINATIONS
- "dHT:R:t:r:b:l:w:h:",
+ "dHR:t:r:b:l:w:h:T:m:",
#else
"dHR:t:r:b:l:w:h:",
#endif // TAGSTATS_COUNT_TAG_COMBINATIONS
@@ -118,6 +123,9 @@ int main(int argc, char *argv[]) {
case 'T':
tags_list = optarg;
break;
+ case 'm':
+ min_tag_combination_count = atoi(optarg);
+ break;
#endif // TAGSTATS_COUNT_TAG_COMBINATIONS
case 'R':
relation_type_list = optarg;
@@ -154,7 +162,7 @@ int main(int argc, char *argv[]) {
Osmium::OSMFile infile(argv[optind]);
Sqlite::Database db(argv[optind+1]);
MapToInt<rough_position_t> map_to_int(left, bottom, right, top, width, height);
- TagStatsHandler handler(db, tags_list, relation_type_list, map_to_int);
+ TagStatsHandler handler(db, tags_list, relation_type_list, map_to_int, min_tag_combination_count);
Osmium::Input::read(infile, handler);
}