Skip to content

Commit

Permalink
Fix neglected --accumulate-attribute when binning
Browse files Browse the repository at this point in the history
  • Loading branch information
e-n-f committed Sep 18, 2024
1 parent d3dfe7f commit e60ca59
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 2 additions & 3 deletions clip.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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--) {
Expand Down

0 comments on commit e60ca59

Please sign in to comment.