summaryrefslogtreecommitdiff
path: root/tagstats
diff options
context:
space:
mode:
authorJochen Topf <jochen@topf.org>2013-06-17 16:28:03 +0200
committerJochen Topf <jochen@topf.org>2013-06-17 16:28:03 +0200
commita80c9781ed17c9dcdb988e50112c8a11438f558a (patch)
treeb7c72e3e4ad45301e9c03370a36b2082bc7637d1 /tagstats
parent80df6bf43254283945c052af1018c1ef4cc9f038 (diff)
downloadtaginfo-a80c9781ed17c9dcdb988e50112c8a11438f558a.tar
taginfo-a80c9781ed17c9dcdb988e50112c8a11438f558a.tar.gz
Add stats for way node distribution
Diffstat (limited to 'tagstats')
-rw-r--r--tagstats/statistics_handler.hpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/tagstats/statistics_handler.hpp b/tagstats/statistics_handler.hpp
index ad5c91a..04801ea 100644
--- a/tagstats/statistics_handler.hpp
+++ b/tagstats/statistics_handler.hpp
@@ -47,6 +47,9 @@ public:
"ways",
"way_tags",
"way_nodes",
+ "way_nodes_consecutive",
+ "way_nodes_within_127",
+ "way_nodes_within_32767",
"max_way_id",
"max_tags_on_way",
"max_nodes_on_way",
@@ -119,6 +122,19 @@ public:
m_stats.max_way_version = m_version;
}
m_stats.sum_way_version += m_version;
+
+ osm_object_id_t ref = 0;
+ BOOST_FOREACH(const Osmium::OSM::WayNode& wn, way->nodes()) {
+ osm_object_id_t diff = wn.ref() - ref;
+ if (diff == 1) {
+ ++m_stats.way_nodes_consecutive;
+ } else if (diff <= 127) { // 2^7-1
+ ++m_stats.way_nodes_within_127;
+ } else if (diff <= 32767) { // 2^15-1
+ ++m_stats.way_nodes_within_32767;
+ }
+ ref = wn.ref();
+ }
}
void relation(const shared_ptr<Osmium::OSM::Relation const>& relation) {
@@ -186,6 +202,9 @@ private:
uint64_t ways;
uint64_t way_tags;
uint64_t way_nodes;
+ uint64_t way_nodes_consecutive;
+ uint64_t way_nodes_within_127;
+ uint64_t way_nodes_within_32767;
uint64_t max_way_id;
uint64_t max_tags_on_way;
uint64_t max_nodes_on_way;