Deduplicate in tippecanoe-overzoom even when the duplicate is clipped away (#353)

* Deduplicate by ID even when the duplicate is clipped away

* Test that deduplication works across tile boundaries

* Update version and changelog
This commit is contained in:
Erica Fischer
2025-07-24 13:21:10 -07:00
committed by GitHub
parent 6dd49be6c9
commit 68ab8dcc22
8 changed files with 45 additions and 26 deletions
+18
View File
@@ -2145,6 +2145,9 @@ std::string overzoom(std::vector<source_tile> const &tiles, int nz, int nx, int
long long b = outtilesize * buffer / 256;
if (xmax < -b || ymax < -b || xmin > outtilesize + b || ymin > outtilesize + b) {
// quick exclusion by bounding box
if (deduplicate_by_id && feature.has_id) {
deduplicate_by_id_set->insert(feature.id);
}
continue;
}
@@ -2160,6 +2163,9 @@ std::string overzoom(std::vector<source_tile> const &tiles, int nz, int nx, int
if (geom.size() == 0) {
// clipped away
if (deduplicate_by_id && feature.has_id) {
deduplicate_by_id_set->insert(feature.id);
}
continue;
}
@@ -2194,6 +2200,10 @@ std::string overzoom(std::vector<source_tile> const &tiles, int nz, int nx, int
std::set<std::string> exclude_attributes;
if (filter != NULL && !evaluate(feature, layer, filter, exclude_attributes, nz, unidecode_data)) {
// filtered away
if (deduplicate_by_id && feature.has_id) {
deduplicate_by_id_set->insert(feature.id);
}
continue;
}
@@ -2231,6 +2241,14 @@ std::string overzoom(std::vector<source_tile> const &tiles, int nz, int nx, int
geom = close_poly(geom);
}
if (geom.size() == 0) {
// simplified away
if (deduplicate_by_id && feature.has_id) {
deduplicate_by_id_set->insert(feature.id);
}
continue;
}
tile_feature tf;
tf.geom = std::move(geom);
tf.t = t;