diff --git a/mbtiles.cpp b/mbtiles.cpp index 693aea02..60a631f7 100644 --- a/mbtiles.cpp +++ b/mbtiles.cpp @@ -289,11 +289,13 @@ void tilestats(std::map const &layermap1, size_t el double yd = attribute.second.ysum / attribute.second.count; double d = sqrt(xd * xd + yd * yd); +#if 0 printf("%s %0.6f", attribute.first.c_str(), d); if (attribute.second.numeric_count != 0) { printf(" %f %f", attribute.second.mean, sqrt(attribute.second.m2 / attribute.second.numeric_count)); } printf("\n"); +#endif size_t val_count = attribute.second.sample_values.size(); if (val_count > max_tilestats_sample_values) { diff --git a/tile.cpp b/tile.cpp index 528741b8..ad9dedd0 100644 --- a/tile.cpp +++ b/tile.cpp @@ -241,6 +241,8 @@ static int metacmp(const std::vector &keys1, const std::vector *merged_layermaps, std::string const &layername) { + double sum = 0; + auto layer = merged_layermaps->find(layername); if (layer == merged_layermaps->end()) { fprintf(stderr, "Can't find layer %s\n", layername.c_str()); @@ -272,12 +274,18 @@ double get_interestingness(const serial_feature *sf, const std::mapstringpool + sf->values[i] + 1); + // printf("%f: %s %s\n", categoricality * interestingness, key.string_value.c_str(), sf->stringpool + sf->values[i] + 1); + sum += categoricality * interestingness; + } + + if (sf->stringpool[sf->values[i]] == mvt_double) { + double stddev = sqrt(tass->second.m2 / tass->second.numeric_count); + sum += fabs(atof(sf->stringpool + sf->values[i] + 1) - tass->second.mean) / stddev; } } } - return 0; + return sum; } static mvt_value find_attribute_value(const serial_feature *sf, std::string key, const std::map *merged_layermaps, std::string const &layername) {