Add --deduplicate-by-id option to tippecanoe-overzoom (#331)

* Add option to deduplicate by feature ID in overzoom

* Add test, fix default

* Update version and changelog
This commit is contained in:
Erica Fischer
2025-04-03 12:48:29 -07:00
committed by GitHub
parent bfb62ee2db
commit 94929b048c
11 changed files with 94 additions and 13 deletions
+8 -1
View File
@@ -19,6 +19,7 @@ int detail = 12; // tippecanoe-style: mvt extent == 1 << detail
int buffer = 5; // tippecanoe-style: mvt buffer == extent * buffer / 256;
bool demultiply = false;
bool do_compress = true;
bool deduplicate_by_id = false;
std::string filter;
bool preserve_input_order = false;
@@ -94,6 +95,7 @@ int main(int argc, char **argv) {
{"clip-bounding-box", required_argument, 0, 'k' & 0x1F},
{"clip-polygon", required_argument, 0, 'l' & 0x1F},
{"clip-polygon-file", required_argument, 0, 'm' & 0x1F},
{"deduplicate-by-id", no_argument, 0, 'i' & 0x1F},
{0, 0, 0, 0},
};
@@ -213,6 +215,11 @@ int main(int argc, char **argv) {
break;
}
case 'i' & 0x1F: {
deduplicate_by_id = true;
break;
}
default:
fprintf(stderr, "Unrecognized flag -%c\n", i);
usage(argv);
@@ -354,7 +361,7 @@ int main(int argc, char **argv) {
its.push_back(std::move(t));
}
out = overzoom(its, nz, nx, ny, detail, buffer, keep, exclude, exclude_prefix, do_compress, NULL, demultiply, json_filter, preserve_input_order, attribute_accum, unidecode_data, simplification, tiny_polygon_size, bins, bin_by_id_list, accumulate_numeric, SIZE_MAX, clipbboxes);
out = overzoom(its, nz, nx, ny, detail, buffer, keep, exclude, exclude_prefix, do_compress, NULL, demultiply, json_filter, preserve_input_order, attribute_accum, unidecode_data, simplification, tiny_polygon_size, bins, bin_by_id_list, accumulate_numeric, SIZE_MAX, clipbboxes, deduplicate_by_id);
}
FILE *f = fopen(outfile, "wb");