Fix neglected --accumulate-attribute when binning

This commit is contained in:
Erica Fischer
2024-09-18 14:35:39 -07:00
parent d3dfe7f45d
commit e60ca59502
2 changed files with 3 additions and 4 deletions
+1 -1
View File
@@ -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
+2 -3
View File
@@ -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<mvt_layer> const &bins, int z, int x, int y, int detail,
std::unordered_map<std::string, attribute_op> const &attribute_accum,
std::string const &accumulate_numeric) {
std::vector<index_event> events;
@@ -1531,8 +1532,6 @@ mvt_tile assign_to_bins(mvt_tile const &features, std::vector<mvt_layer> const &
} else /* EXIT */ {
auto const &found = active.find({e.layer, e.feature});
if (found != active.end()) {
std::unordered_map<std::string, attribute_op> attribute_accum;
if (outfeatures[found->outfeature].size() > 1) {
feature_out(outfeatures[found->outfeature], outlayer,
std::set<std::string>(), attribute_accum,
@@ -1797,7 +1796,7 @@ std::string overzoom(std::vector<source_tile> 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--) {