diff --git a/tile.cpp b/tile.cpp index 9e59760e..2d53e9b8 100644 --- a/tile.cpp +++ b/tile.cpp @@ -2495,8 +2495,10 @@ long long write_tile(decompressor *geoms, std::atomic *geompos_in, ch arg->feature_count_out = totalsize; } + size_t estimated = totalsize * (lead_features_count + other_multiplier_cluster_features_count) / lead_features_count; + if (!quiet) { - fprintf(stderr, "tile %d/%u/%u has %zu features, >%zu \n", z, tx, ty, totalsize, scaled_max_tile_features); + fprintf(stderr, "tile %d/%u/%u has %zu (%zu) features, >%zu \n", z, tx, ty, totalsize, estimated, scaled_max_tile_features); } if (trying_to_stop_early && line_detail == first_detail) { @@ -2522,7 +2524,7 @@ long long write_tile(decompressor *geoms, std::atomic *geompos_in, ch line_detail++; // to keep it the same when the loop decrements it continue; } else if (mingap < ULONG_MAX && (additional[A_DROP_DENSEST_AS_NEEDED] || additional[A_COALESCE_DENSEST_AS_NEEDED] || additional[A_CLUSTER_DENSEST_AS_NEEDED])) { - mingap_fraction = mingap_fraction * scaled_max_tile_features / totalsize * 0.80; + mingap_fraction = mingap_fraction * scaled_max_tile_features / estimated * 0.80; unsigned long long m = choose_mingap(gaps, mingap_fraction, mingap); if (m != mingap) { mingap = m; @@ -2537,7 +2539,7 @@ long long write_tile(decompressor *geoms, std::atomic *geompos_in, ch continue; } } else if (additional[A_DROP_SMALLEST_AS_NEEDED] || additional[A_COALESCE_SMALLEST_AS_NEEDED]) { - minextent_fraction = minextent_fraction * scaled_max_tile_features / totalsize * 0.75; + minextent_fraction = minextent_fraction * scaled_max_tile_features / estimated * 0.75; long long m = choose_minextent(extents, minextent_fraction, minextent); if (m != minextent) { minextent = m; @@ -2555,7 +2557,7 @@ long long write_tile(decompressor *geoms, std::atomic *geompos_in, ch // The 95% is a guess to avoid too many retries // and probably actually varies based on how much duplicated metadata there is - mindrop_sequence_fraction = mindrop_sequence_fraction * scaled_max_tile_features / totalsize * 0.95; + mindrop_sequence_fraction = mindrop_sequence_fraction * scaled_max_tile_features / estimated * 0.95; unsigned long long m = choose_mindrop_sequence(drop_sequences, mindrop_sequence_fraction, mindrop_sequence); if (m != mindrop_sequence) { mindrop_sequence = m;