mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-02 16:35:40 +02:00
Don't always keep the first feature in a tile, after all
This commit is contained in:
@@ -1079,7 +1079,7 @@ static serial_feature next_feature(decompressor *geoms, std::atomic<long long> *
|
||||
if (sf.geometry.size() > 0) {
|
||||
(*unclipped_features)++;
|
||||
} else {
|
||||
// XXX should continue, but affects test outputs
|
||||
continue;
|
||||
}
|
||||
|
||||
if (first_time && pass == 0) { /* only write out the next zoom once, even if we retry */
|
||||
@@ -1163,13 +1163,13 @@ static serial_feature next_feature(decompressor *geoms, std::atomic<long long> *
|
||||
|
||||
std::string &layername = (*layer_unmaps)[sf.segment][sf.layer];
|
||||
auto count = multiplier_state->count.find(layername);
|
||||
if (count == multiplier_state->count.end()) {
|
||||
multiplier_state->count.emplace(layername, 0);
|
||||
count = multiplier_state->count.find(layername);
|
||||
sf.dropped = FEATURE_KEPT; // the first feature in each tile is always kept
|
||||
}
|
||||
|
||||
if (z >= sf.feature_minzoom || sf.dropped == FEATURE_KEPT) {
|
||||
if (z >= sf.feature_minzoom) {
|
||||
if (count == multiplier_state->count.end()) {
|
||||
multiplier_state->count.emplace(layername, 0);
|
||||
count = multiplier_state->count.find(layername);
|
||||
}
|
||||
|
||||
count->second = 0;
|
||||
sf.dropped = FEATURE_KEPT; // feature is kept
|
||||
|
||||
@@ -1178,6 +1178,12 @@ static serial_feature next_feature(decompressor *geoms, std::atomic<long long> *
|
||||
sf.full_values.emplace_back(mvt_bool, "true");
|
||||
}
|
||||
} else if (count->second + 1 < retain_points_multiplier) {
|
||||
if (count == multiplier_state->count.end()) {
|
||||
// just drop features until we reach one that is
|
||||
// supposed to appear in this zoom level
|
||||
continue;
|
||||
}
|
||||
|
||||
count->second++;
|
||||
sf.dropped = count->second;
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user