Merge branch 'h3-index' into faster-bin-assign

This commit is contained in:
Erica Fischer
2025-03-28 13:23:28 -07:00
9 changed files with 10020 additions and 19 deletions
+22
View File
@@ -94,11 +94,13 @@ unsigned int drop_denser = 0;
std::map<std::string, serial_val> set_attributes;
unsigned long long preserve_point_density_threshold = 0;
unsigned long long preserve_multiplier_density_threshold = 0;
std::vector<int> preserve_multiplier_density_bits_by_zoom;
long long extend_zooms_max = 0;
int retain_points_multiplier = 1;
std::vector<std::string> unidecode_data;
size_t maximum_string_attribute_length = 0;
std::string accumulate_numeric;
std::string use_h3_index;
std::vector<order_field> order_by;
bool order_reverse;
@@ -2498,6 +2500,7 @@ std::pair<int, metadata> read_input(std::vector<source> &sources, char *fname, i
long long ip;
for (ip = 0; ip < indices; ip++) {
unsigned xx, yy;
// XXX this will behave oddly if the index is actually H3
decode_index(map[ip].ix, &xx, &yy);
long long nprogress = 100 * ip / indices;
@@ -3087,6 +3090,7 @@ int main(int argc, char **argv) {
{"cluster-maxzoom", required_argument, 0, 'k'},
{"preserve-point-density-threshold", required_argument, 0, '~'},
{"preserve-multiplier-density-threshold", required_argument, 0, '~'},
{"preserve-multiplier-density-bits-by-zoom", required_argument, 0, '~'},
{"Dropping or merging a fraction of features to keep under tile size limits", 0, 0, 0},
{"drop-densest-as-needed", no_argument, &additional[A_DROP_DENSEST_AS_NEEDED], 1},
@@ -3129,6 +3133,7 @@ int main(int argc, char **argv) {
{"coalesce", no_argument, &additional[A_COALESCE], 1},
{"reverse", no_argument, &additional[A_REVERSE], 1},
{"hilbert", no_argument, &additional[A_HILBERT], 1},
{"use-h3-index", required_argument, 0, '~'},
{"order-by", required_argument, 0, '~'},
{"order-descending-by", required_argument, 0, '~'},
{"order-smallest-first", no_argument, 0, '~'},
@@ -3270,6 +3275,8 @@ int main(int argc, char **argv) {
fprintf(stderr, "%s: --extra-detail can be at most 30\n", argv[0]);
exit(EXIT_ARGS);
}
} else if (strcmp(opt, "use-h3-index") == 0) {
use_h3_index = optarg;
} else if (strcmp(opt, "order-by") == 0) {
order_by.push_back(order_field(optarg, false));
} else if (strcmp(opt, "order-descending-by") == 0) {
@@ -3301,6 +3308,21 @@ int main(int argc, char **argv) {
preserve_point_density_threshold = atoll_require(optarg, "Preserve point density threshold");
} else if (strcmp(opt, "preserve-multiplier-density-threshold") == 0) {
preserve_multiplier_density_threshold = atoll_require(optarg, "Preserve multiplier density threshold");
} else if (strcmp(opt, "preserve-multiplier-density-bits-by-zoom") == 0) {
const char *cp = optarg;
while (*cp != '\0') {
if (!isdigit(*cp)) {
fprintf(stderr, "%s: unexpected multiplier density bits by zoom %s\n", argv[0], cp);
exit(EXIT_ARGS);
}
preserve_multiplier_density_bits_by_zoom.push_back(atoi(cp));
while (isdigit(*cp)) {
cp++;
}
if (*cp == ',') {
cp++;
}
}
} else if (strcmp(opt, "extend-zooms-if-still-dropping-maximum") == 0) {
extend_zooms_max = atoll_require(optarg, "Maximum number by which to extend zooms");
} else if (strcmp(opt, "retain-points-multiplier") == 0) {