mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-02 08:25:40 +02:00
Track zoom truncation in the strategies list in the tileset metadata
This commit is contained in:
@@ -444,6 +444,14 @@ std::string stringify_strategies(std::vector<strategy> const &strategies) {
|
||||
any = true;
|
||||
}
|
||||
|
||||
if (strategies[i].truncated_zooms > 0) {
|
||||
state.nospace = true;
|
||||
state.json_write_string("truncated_zooms");
|
||||
state.nospace = true;
|
||||
state.json_write_number(strategies[i].truncated_zooms);
|
||||
any = true;
|
||||
}
|
||||
|
||||
state.nospace = true;
|
||||
state.json_end_hash();
|
||||
}
|
||||
|
||||
+1
@@ -9,6 +9,7 @@
|
||||
"maxzoom": "20",
|
||||
"minzoom": "0",
|
||||
"name": "tests/ne_110m_populated_places/out/-z20_-r1_--truncate-zooms_--limit-tile-feature-count_50.json.check.mbtiles",
|
||||
"strategies": "[{},{\"truncated_zooms\":2},{\"truncated_zooms\":2},{\"truncated_zooms\":8},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{},{}]",
|
||||
"tippecanoe_decisions": "{\"basezoom\":20,\"droprate\":1,\"retain_points_multiplier\":1}",
|
||||
"type": "overlay",
|
||||
"version": "2"
|
||||
|
||||
+1
-1
@@ -9,7 +9,7 @@
|
||||
"maxzoom": "14",
|
||||
"minzoom": "12",
|
||||
"name": "tests/tl_2022_11_tract/out/-z14_-Z12_--coalesce-densest-as-needed_--truncate-zooms_-M25000.json.check.mbtiles",
|
||||
"strategies": "[{},{},{},{},{},{},{},{},{},{},{},{},{\"coalesced_as_needed\":87,\"tile_size_desired\":39190},{},{}]",
|
||||
"strategies": "[{},{},{},{},{},{},{},{},{},{},{},{},{\"coalesced_as_needed\":87,\"tile_size_desired\":39190,\"truncated_zooms\":3},{\"truncated_zooms\":18},{}]",
|
||||
"type": "overlay",
|
||||
"version": "2"
|
||||
}, "features": [
|
||||
|
||||
@@ -877,6 +877,8 @@ void handle_strategies(const unsigned char *s, std::vector<strategy> *st) {
|
||||
(*st)[i].dropped_as_needed += v->value.number.number;
|
||||
} else if (strcmp(k->value.string.string, "coalesced_as_needed") == 0) {
|
||||
(*st)[i].coalesced_as_needed += v->value.number.number;
|
||||
} else if (strcmp(k->value.string.string, "truncated_zooms") == 0) {
|
||||
(*st)[i].truncated_zooms += v->value.number.number;
|
||||
} else if (strcmp(k->value.string.string, "detail_reduced") == 0) {
|
||||
(*st)[i].detail_reduced += v->value.number.number;
|
||||
} else if (strcmp(k->value.string.string, "tiny_polygons") == 0) {
|
||||
|
||||
@@ -2697,6 +2697,7 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
|
||||
// We succeeded in stopping early.
|
||||
// Prune the child tiles.
|
||||
|
||||
strategy.truncated_zooms++;
|
||||
skip_children_out.insert(zxy(z, tx, ty));
|
||||
}
|
||||
|
||||
@@ -3206,4 +3207,5 @@ void atomic_strategy::add_from(struct strategy const &src) {
|
||||
coalesced_as_needed += src.coalesced_as_needed;
|
||||
detail_reduced += src.detail_reduced;
|
||||
tiny_polygons += src.tiny_polygons;
|
||||
truncated_zooms += src.truncated_zooms;
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ struct atomic_strategy {
|
||||
std::atomic<size_t> coalesced_as_needed;
|
||||
std::atomic<size_t> detail_reduced;
|
||||
std::atomic<size_t> tiny_polygons;
|
||||
std::atomic<size_t> truncated_zooms;
|
||||
|
||||
atomic_strategy()
|
||||
: dropped_by_rate(0),
|
||||
@@ -25,7 +26,8 @@ struct atomic_strategy {
|
||||
dropped_as_needed(0),
|
||||
coalesced_as_needed(0),
|
||||
detail_reduced(0),
|
||||
tiny_polygons(0) {
|
||||
tiny_polygons(0),
|
||||
truncated_zooms(0) {
|
||||
}
|
||||
|
||||
void add_from(struct strategy const &src);
|
||||
@@ -38,6 +40,7 @@ struct strategy {
|
||||
size_t coalesced_as_needed = 0;
|
||||
size_t detail_reduced = 0;
|
||||
size_t tiny_polygons = 0;
|
||||
size_t truncated_zooms = 0;
|
||||
|
||||
size_t tile_size = 0;
|
||||
size_t feature_count = 0;
|
||||
@@ -51,6 +54,7 @@ struct strategy {
|
||||
tile_size = ts;
|
||||
feature_count = fc;
|
||||
tiny_polygons = s.tiny_polygons;
|
||||
truncated_zooms = s.truncated_zooms;
|
||||
}
|
||||
|
||||
strategy() = default;
|
||||
|
||||
Reference in New Issue
Block a user