From a1d5747cfd8144da30b42054a6587377736a6ed3 Mon Sep 17 00:00:00 2001 From: Jochen Topf Date: Mon, 7 Oct 2013 18:36:15 +0200 Subject: Make min_tag_combination_count configurable at runtime --- tagstats/tagstats.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'tagstats/tagstats.cpp') 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 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); } -- cgit v1.2.3