Skip to content

Commit 7a0878d

Browse files
committed
Fix backwards conditional
1 parent 56655e6 commit 7a0878d

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

Diff for: Makefile

+3-3
Original file line numberDiff line numberDiff line change
@@ -367,15 +367,15 @@ overzoom-test: tippecanoe-overzoom
367367
cmp tests/pbf/bin-11-327-791.pbf.out.json.check tests/pbf/bin-11-327-791.pbf.out.json
368368
rm tests/pbf/bin-11-327-791.pbf.out.json.check tests/pbf/bin-11-327-791.pbf.out
369369
# Binning with longitude wraparound problems
370-
./tippecanoe-overzoom -o tests/pbf/0-0-0-pop-2-0-1.pbf.out --assign-to-bins tests/pbf/h3-2-0-1.geojson tests/pbf/0-0-0.pbf 2/0/1 2/0/1
370+
./tippecanoe-overzoom -o tests/pbf/0-0-0-pop-2-0-1.pbf.out --accumulate-numeric-attributes --assign-to-bins tests/pbf/h3-2-0-1.geojson tests/pbf/0-0-0.pbf 2/0/1 2/0/1
371371
./tippecanoe-decode tests/pbf/0-0-0-pop-2-0-1.pbf.out 2 0 1 > tests/pbf/0-0-0-pop-2-0-1.pbf.out.json.check
372372
cmp tests/pbf/0-0-0-pop-2-0-1.pbf.out.json.check tests/pbf/0-0-0-pop-2-0-1.pbf.out.json
373373
rm tests/pbf/0-0-0-pop-2-0-1.pbf.out tests/pbf/0-0-0-pop-2-0-1.pbf.out.json.check
374-
./tippecanoe-overzoom -o tests/pbf/0-0-0-pop-1-1-0.pbf.out --assign-to-bins tests/pbf/h3-1-1-0.geojson tests/pbf/0-0-0.pbf 1/1/0 1/1/0
374+
./tippecanoe-overzoom -o tests/pbf/0-0-0-pop-1-1-0.pbf.out --accumulate-numeric-attributes --assign-to-bins tests/pbf/h3-1-1-0.geojson tests/pbf/0-0-0.pbf 1/1/0 1/1/0
375375
./tippecanoe-decode tests/pbf/0-0-0-pop-1-1-0.pbf.out 1 1 0 > tests/pbf/0-0-0-pop-1-1-0.pbf.out.json.check
376376
cmp tests/pbf/0-0-0-pop-1-1-0.pbf.out.json.check tests/pbf/0-0-0-pop-1-1-0.pbf.out.json
377377
rm tests/pbf/0-0-0-pop-1-1-0.pbf.out tests/pbf/0-0-0-pop-1-1-0.pbf.out.json.check
378-
./tippecanoe-overzoom -o tests/pbf/0-0-0-pop-0-0-0.pbf.out --assign-to-bins tests/pbf/h3-0-0-0.geojson tests/pbf/0-0-0.pbf 0/0/0 0/0/0
378+
./tippecanoe-overzoom -o tests/pbf/0-0-0-pop-0-0-0.pbf.out --accumulate-numeric-attributes --assign-to-bins tests/pbf/h3-0-0-0.geojson tests/pbf/0-0-0.pbf 0/0/0 0/0/0
379379
./tippecanoe-decode tests/pbf/0-0-0-pop-0-0-0.pbf.out 0 0 0 > tests/pbf/0-0-0-pop-0-0-0.pbf.out.json.check
380380
cmp tests/pbf/0-0-0-pop-0-0-0.pbf.out.json.check tests/pbf/0-0-0-pop-0-0-0.pbf.out.json
381381
rm tests/pbf/0-0-0-pop-0-0-0.pbf.out tests/pbf/0-0-0-pop-0-0-0.pbf.out.json.check

Diff for: clip.cpp

+5-4
Original file line numberDiff line numberDiff line change
@@ -1157,14 +1157,14 @@ static void feature_out(std::vector<tile_feature> const &features, mvt_layer &ou
11571157
std::map<std::string, size_t> numeric_out_field;
11581158

11591159
for (size_t i = 0; i + 1 < features[0].tags.size(); i += 2) {
1160-
auto f = attribute_accum.find(features[0].layer->keys[features[0].tags[i]]);
1160+
const std::string &key = features[0].layer->keys[features[0].tags[i]];
1161+
auto f = attribute_accum.find(key);
11611162
if (f != attribute_accum.end()) {
11621163
// this attribute has an accumulator, so convert it
11631164
full_keys.push_back(features[0].layer->keys[features[0].tags[i]]);
11641165
full_values.push_back(mvt_value_to_serial_val(features[0].layer->values[features[0].tags[i + 1]]));
11651166
} else if (accumulate_numeric && features[0].layer->values[features[0].tags[i + 1]].is_numeric()) {
11661167
// convert numeric for accumulation
1167-
const std::string &key = features[0].layer->keys[features[0].tags[i]];
11681168
numeric_out_field.emplace(key, full_keys.size());
11691169
full_keys.push_back(key);
11701170
full_values.push_back(mvt_value_to_serial_val(features[0].layer->values[features[0].tags[i + 1]]));
@@ -1202,8 +1202,9 @@ static void feature_out(std::vector<tile_feature> const &features, mvt_layer &ou
12021202
// same attribute, we want to use that one instead of this one.
12031203

12041204
for (auto const &op : numeric_operations) {
1205-
auto compound_found = keys.find("tipppecanoe:" + op.first + ":" + key);
1206-
if (compound_found == keys.end()) {
1205+
std::string compound_key = "tipppecanoe:" + op.first + ":" + key;
1206+
auto compound_found = keys.find(compound_key);
1207+
if (compound_found != keys.end()) {
12071208
// found, so skip this one
12081209
} else {
12091210
// not found, so accumulate this one

0 commit comments

Comments
 (0)