Revert "Add a flag to retain multiplier features by minimum distance"

This reverts commit 01f14a4255.
This commit is contained in:
Erica Fischer
2024-10-10 13:20:04 -07:00
parent 44a683d808
commit 776da4a1b8
4 changed files with 1 additions and 15 deletions
-4
View File
@@ -93,7 +93,6 @@ size_t limit_tile_feature_count_at_maxzoom = 0;
unsigned int drop_denser = 0; unsigned int drop_denser = 0;
std::map<std::string, serial_val> set_attributes; std::map<std::string, serial_val> set_attributes;
unsigned long long preserve_point_density_threshold = 0; unsigned long long preserve_point_density_threshold = 0;
unsigned long long preserve_multiplier_density_threshold = 0;
long long extend_zooms_max = 0; long long extend_zooms_max = 0;
int retain_points_multiplier = 1; int retain_points_multiplier = 1;
std::vector<std::string> unidecode_data; std::vector<std::string> unidecode_data;
@@ -3110,7 +3109,6 @@ int main(int argc, char **argv) {
{"cluster-distance", required_argument, 0, 'K'}, {"cluster-distance", required_argument, 0, 'K'},
{"cluster-maxzoom", required_argument, 0, 'k'}, {"cluster-maxzoom", required_argument, 0, 'k'},
{"preserve-point-density-threshold", required_argument, 0, '~'}, {"preserve-point-density-threshold", required_argument, 0, '~'},
{"preserve-multiplier-density-threshold", required_argument, 0, '~'},
{"Dropping or merging a fraction of features to keep under tile size limits", 0, 0, 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}, {"drop-densest-as-needed", no_argument, &additional[A_DROP_DENSEST_AS_NEEDED], 1},
@@ -3322,8 +3320,6 @@ int main(int argc, char **argv) {
} }
} else if (strcmp(opt, "preserve-point-density-threshold") == 0) { } else if (strcmp(opt, "preserve-point-density-threshold") == 0) {
preserve_point_density_threshold = atoll_require(optarg, "Preserve point density threshold"); 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, "extend-zooms-if-still-dropping-maximum") == 0) { } else if (strcmp(opt, "extend-zooms-if-still-dropping-maximum") == 0) {
extend_zooms_max = atoll_require(optarg, "Maximum number by which to extend zooms"); extend_zooms_max = atoll_require(optarg, "Maximum number by which to extend zooms");
} else if (strcmp(opt, "retain-points-multiplier") == 0) { } else if (strcmp(opt, "retain-points-multiplier") == 0) {
-1
View File
@@ -65,7 +65,6 @@ extern long long extend_zooms_max;
extern int retain_points_multiplier; extern int retain_points_multiplier;
extern size_t maximum_string_attribute_length; extern size_t maximum_string_attribute_length;
extern std::string accumulate_numeric; extern std::string accumulate_numeric;
extern unsigned long long preserve_multiplier_density_threshold;
struct order_field { struct order_field {
std::string name; std::string name;
-1
View File
@@ -94,7 +94,6 @@ struct serial_feature {
#define FEATURE_DROPPED -1 #define FEATURE_DROPPED -1
#define FEATURE_KEPT 0 #define FEATURE_KEPT 0
#define FEATURE_NO_REALLY_KEEP_IT_AROUND INT_MAX
// <0: dropped // <0: dropped
// 0: kept // 0: kept
// >0: sequence number of additional feature kept by retain-points-multiplier // >0: sequence number of additional feature kept by retain-points-multiplier
+1 -9
View File
@@ -1237,9 +1237,6 @@ static serial_feature next_feature(decompressor *geoms, std::atomic<long long> *
} else if (z + extra_multiplier_zooms >= feature_minzoom && count->second + 1 < retain_points_multiplier) { } else if (z + extra_multiplier_zooms >= feature_minzoom && count->second + 1 < retain_points_multiplier) {
count->second++; count->second++;
sf.dropped = count->second; sf.dropped = count->second;
} else if (preserve_multiplier_density_threshold > 0 &&
sf.gap > ((1LL << (32 - z)) / preserve_multiplier_density_threshold) * ((1LL << (32 - z)) / preserve_multiplier_density_threshold)) {
sf.dropped = FEATURE_NO_REALLY_KEEP_IT_AROUND;
} else { } else {
sf.dropped = FEATURE_DROPPED; sf.dropped = FEATURE_DROPPED;
} }
@@ -1901,11 +1898,8 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
} else { } else {
can_stop_early = false; can_stop_early = false;
if (sf.dropped != FEATURE_DROPPED && sf.dropped != FEATURE_NO_REALLY_KEEP_IT_AROUND) { if (sf.dropped != FEATURE_DROPPED) {
// Does the current multiplier cluster already have too many features? // Does the current multiplier cluster already have too many features?
// (Because we are dropping dynamically, and we have already filled the
// cluster with features that were dynamically dropped from being
// primary features)
// If so, we have to drop this one, even if it would potentially qualify // If so, we have to drop this one, even if it would potentially qualify
// as a secondary feature to be exposed by filtering // as a secondary feature to be exposed by filtering
if (layer.multiplier_cluster_size >= (size_t) retain_points_multiplier) { if (layer.multiplier_cluster_size >= (size_t) retain_points_multiplier) {
@@ -2152,8 +2146,6 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
if (sf.dropped == FEATURE_KEPT) { if (sf.dropped == FEATURE_KEPT) {
layer.multiplier_cluster_size = 1; layer.multiplier_cluster_size = 1;
lead_features_count++; lead_features_count++;
} else if (sf.dropped == FEATURE_NO_REALLY_KEEP_IT_AROUND) {
other_multiplier_cluster_features_count++;
} else { } else {
layer.multiplier_cluster_size++; layer.multiplier_cluster_size++;
other_multiplier_cluster_features_count++; other_multiplier_cluster_features_count++;