summaryrefslogtreecommitdiff
path: root/tagstats
diff options
context:
space:
mode:
authorJochen Topf <jochen@topf.org>2014-05-15 10:05:46 +0200
committerJochen Topf <jochen@topf.org>2014-05-15 10:05:46 +0200
commit76521dd9aae3fc95fcc974dd51bb86acf4f083df (patch)
treee7db5df093f9e11b76f7b6079fa83a08a1e5aaed /tagstats
parentff2995158556ede9593b70daea16b467c50278f0 (diff)
downloadtaginfo-76521dd9aae3fc95fcc974dd51bb86acf4f083df.tar
taginfo-76521dd9aae3fc95fcc974dd51bb86acf4f083df.tar.gz
Removed TAGSTATS_COUNT_TAG_COMBINATIONS.
This preprocessor macro decided whether we wanted to count combinations of tags. This is now always on.
Diffstat (limited to 'tagstats')
-rw-r--r--tagstats/Makefile1
-rw-r--r--tagstats/tagstats.cpp18
-rw-r--r--tagstats/tagstats_handler.hpp15
3 files changed, 4 insertions, 30 deletions
diff --git a/tagstats/Makefile b/tagstats/Makefile
index 464ed5f..baea40c 100644
--- a/tagstats/Makefile
+++ b/tagstats/Makefile
@@ -28,7 +28,6 @@ BYID := $(shell ../bin/taginfo-config.rb tagstats.geodistribution)
BYID_LC := $(shell echo $(BYID) | sed -e 's/\([A-Z]\)/_\1/g' | cut -c2- | tr 'A-Z' 'a-z')
BYID_INCL := "<osmium/storage/byid/$(BYID_LC).hpp>"
-CXXFLAGS_FEATURES += -DTAGSTATS_COUNT_TAG_COMBINATIONS
CXXFLAGS_FEATURES += -DTAGSTATS_GEODISTRIBUTION_INT=$(GEODISTRIBUTION_TYPE)
CXXFLAGS_FEATURES += -DTAGSTATS_GEODISTRIBUTION_FOR_WAYS=$(BYID)
CXXFLAGS_FEATURES += -DTAGSTATS_GEODISTRIBUTION_INCLUDE=$(BYID_INCL)
diff --git a/tagstats/tagstats.cpp b/tagstats/tagstats.cpp
index f0a7a0a..113d82f 100644
--- a/tagstats/tagstats.cpp
+++ b/tagstats/tagstats.cpp
@@ -58,12 +58,10 @@ void print_help() {
<< "on OSM tags from OSMFILE and puts them into DATABASE (an SQLite database).\n" \
<< "\nOptions:\n" \
<< " -H, --help This help message\n" \
- << " -s, --selection-db=DATABASE Name of selection database\n";
-#ifdef TAGSTATS_COUNT_TAG_COMBINATIONS
- std::cout << " -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 << " -t, --top=NUMBER Top of bounding box for distribution images\n" \
+ << " -s, --selection-db=DATABASE Name of selection database\n" \
+ << " -m, --min-tag-combination-count=N Tag combinations not appearing this often\n" \
+ << " are not written to database\n" \
+ << " -t, --top=NUMBER Top of bounding box for distribution images\n" \
<< " -r, --right=NUMBER Right of bounding box for distribution images\n" \
<< " -b, --bottom=NUMBER Bottom of bounding box for distribution images\n" \
<< " -l, --left=NUMBER Left of bounding box for distribution images\n" \
@@ -75,9 +73,7 @@ void print_help() {
int main(int argc, char *argv[]) {
static struct option long_options[] = {
{"help", no_argument, 0, 'H'},
-#ifdef TAGSTATS_COUNT_TAG_COMBINATIONS
{"min-tag-combination-count", required_argument, 0, 'm'},
-#endif // TAGSTATS_COUNT_TAG_COMBINATIONS
{"selection-db", required_argument, 0, 's'},
{"top", required_argument, 0, 't'},
{"right", required_argument, 0, 'r'},
@@ -102,11 +98,7 @@ int main(int argc, char *argv[]) {
while (true) {
int c = getopt_long(argc, argv,
-#ifdef TAGSTATS_COUNT_TAG_COMBINATIONS
"dHt:r:b:l:w:h:s:m:",
-#else
- "dHt:r:b:l:w:h:s:",
-#endif // TAGSTATS_COUNT_TAG_COMBINATIONS
long_options, 0);
if (c == -1) {
break;
@@ -119,11 +111,9 @@ int main(int argc, char *argv[]) {
case 's':
selection_database_name = optarg;
break;
-#ifdef TAGSTATS_COUNT_TAG_COMBINATIONS
case 'm':
min_tag_combination_count = atoi(optarg);
break;
-#endif // TAGSTATS_COUNT_TAG_COMBINATIONS
case 't':
top = atof(optarg);
break;
diff --git a/tagstats/tagstats_handler.hpp b/tagstats/tagstats_handler.hpp
index 696ae45..a5ff15d 100644
--- a/tagstats/tagstats_handler.hpp
+++ b/tagstats/tagstats_handler.hpp
@@ -161,7 +161,6 @@ public:
typedef google::sparse_hash_map<const char *, KeyStats *, djb2_hash, eqstr> key_hash_map_t;
-#ifdef TAGSTATS_COUNT_TAG_COMBINATIONS
/**
* A KeyValueStats object holds some statistics for an OSM tag (key/value pair).
*/
@@ -182,7 +181,6 @@ public:
typedef google::sparse_hash_map<const char *, KeyValueStats *, djb2_hash, eqstr> key_value_hash_map_t;
typedef google::sparse_hash_map<std::pair<const char*, const char*>, GeoDistribution *, djb2_hash, eqstr> key_value_geodistribution_hash_map_t;
-#endif // TAGSTATS_COUNT_TAG_COMBINATIONS
struct RelationRoleStats {
uint32_t node;
@@ -250,9 +248,7 @@ class TagStatsHandler : public Osmium::Handler::Base {
key_hash_map_t tags_stat;
-#ifdef TAGSTATS_COUNT_TAG_COMBINATIONS
key_value_hash_map_t m_key_value_stats;
-#endif // TAGSTATS_COUNT_TAG_COMBINATIONS
key_value_geodistribution_hash_map_t m_key_value_geodistribution;
@@ -287,7 +283,6 @@ class TagStatsHandler : public Osmium::Handler::Base {
}
}
-#ifdef TAGSTATS_COUNT_TAG_COMBINATIONS
void _update_key_value_combination_hash2(const Osmium::OSM::Object& object, Osmium::OSM::TagList::const_iterator it, key_value_hash_map_t::iterator kvi1, std::string& key_value1) {
for (; it != object.tags().end(); ++it) {
std::string key_value2(it->key());
@@ -331,7 +326,6 @@ class TagStatsHandler : public Osmium::Handler::Base {
}
}
}
-#endif // TAGSTATS_COUNT_TAG_COMBINATIONS
void _print_and_clear_key_distribution_images(bool for_nodes) {
int sum_size=0;
@@ -477,10 +471,7 @@ class TagStatsHandler : public Osmium::Handler::Base {
}
_update_key_combination_hash(object);
-
-#ifdef TAGSTATS_COUNT_TAG_COMBINATIONS
_update_key_value_combination_hash(object);
-#endif // TAGSTATS_COUNT_TAG_COMBINATIONS
}
StatisticsHandler statistics_handler;
@@ -508,7 +499,6 @@ public:
if (!selection_database_name.empty()) {
Sqlite::Database sdb(selection_database_name.c_str(), SQLITE_OPEN_READONLY);
-#ifdef TAGSTATS_COUNT_TAG_COMBINATIONS
{
Sqlite::Statement select(sdb, "SELECT key FROM interesting_tags WHERE value IS NULL;");
while (select.read()) {
@@ -523,7 +513,6 @@ public:
m_key_value_stats[m_string_store.add(key_value.c_str())] = new KeyValueStats();
}
}
-#endif // TAGSTATS_COUNT_TAG_COMBINATIONS
{
Sqlite::Statement select(sdb, "SELECT key, value FROM frequent_tags;");
while (select.read()) {
@@ -647,11 +636,9 @@ public:
"count_all, count_nodes, count_ways, count_relations) " \
"VALUES (?, ?, ?, ?, ?, ?);");
-#ifdef TAGSTATS_COUNT_TAG_COMBINATIONS
Sqlite::Statement statement_insert_into_tag_combinations(m_database, "INSERT INTO tag_combinations (key1, value1, key2, value2, " \
"count_all, count_nodes, count_ways, count_relations) " \
"VALUES (?, ?, ?, ?, ?, ?, ?, ?);");
-#endif // TAGSTATS_COUNT_TAG_COMBINATIONS
Sqlite::Statement statement_insert_into_relation_types(m_database, "INSERT INTO relation_types (rtype, count, " \
"members_all, members_nodes, members_ways, members_relations) " \
@@ -735,7 +722,6 @@ public:
delete stat; // lets make valgrind happy
}
-#ifdef TAGSTATS_COUNT_TAG_COMBINATIONS
for (key_value_hash_map_t::const_iterator tags_iterator = m_key_value_stats.begin(); tags_iterator != m_key_value_stats.end(); ++tags_iterator) {
KeyValueStats* stat = tags_iterator->second;
@@ -766,7 +752,6 @@ public:
delete stat; // lets make valgrind happy
}
-#endif // TAGSTATS_COUNT_TAG_COMBINATIONS
typedef std::pair<const std::string, RelationTypeStats> relation_type_stats_map_iterator_t;
typedef std::pair<const std::string, RelationRoleStats> relation_role_stats_map_iterator_t;