From e60ca5950219e5fd0f6a01079467db08f6ee11f8 Mon Sep 17 00:00:00 2001 From: Erica Fischer Date: Wed, 18 Sep 2024 14:35:39 -0700 Subject: [PATCH] Fix neglected --accumulate-attribute when binning --- Makefile | 2 +- clip.cpp | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 610cad8a..e24a3cf4 100644 --- a/Makefile +++ b/Makefile @@ -583,7 +583,7 @@ accumulate-test: test `./tippecanoe-decode -c tests/pbf/bins-0-0-0.pbf 0 0 0 | grep 'clustered:sum:POP1950' | sed 's/.*"clustered:sum:POP1950": //' | awk '{sum += $$1} END {print sum}'` == 161590 # which is the right global total # the cluster sizes still add up to the 243 original features - test `./tippecanoe-decode -c tests/pbf/accum-0-0-0.pbf 0 0 0 | sed 's/.*clustered:cluster_size": //' | awk '{sum += $$1} END {print sum}'` == 243 + test `./tippecanoe-decode -c tests/pbf/bins-0-0-0.pbf 0 0 0 | sed 's/.*clustered:cluster_size": //' | awk '{sum += $$1} END {print sum}'` == 243 join-filter-test: tippecanoe tippecanoe-decode tile-join # Comes out different from the direct tippecanoe run because null attributes are lost diff --git a/clip.cpp b/clip.cpp index 12ee8c73..460a317b 100644 --- a/clip.cpp +++ b/clip.cpp @@ -1437,6 +1437,7 @@ static bool bbox_intersects(long long x1min, long long y1min, long long x1max, l } mvt_tile assign_to_bins(mvt_tile const &features, std::vector const &bins, int z, int x, int y, int detail, + std::unordered_map const &attribute_accum, std::string const &accumulate_numeric) { std::vector events; @@ -1531,8 +1532,6 @@ mvt_tile assign_to_bins(mvt_tile const &features, std::vector const & } else /* EXIT */ { auto const &found = active.find({e.layer, e.feature}); if (found != active.end()) { - std::unordered_map attribute_accum; - if (outfeatures[found->outfeature].size() > 1) { feature_out(outfeatures[found->outfeature], outlayer, std::set(), attribute_accum, @@ -1797,7 +1796,7 @@ std::string overzoom(std::vector const &tiles, int nz, int nx, int } if (bins.size() > 0) { - outtile = assign_to_bins(outtile, bins, nz, nx, ny, detail, accumulate_numeric); + outtile = assign_to_bins(outtile, bins, nz, nx, ny, detail, attribute_accum, accumulate_numeric); } for (ssize_t i = outtile.layers.size() - 1; i >= 0; i--) {