mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-05 18:05:42 +02:00
Scale tile feature limit for megatiles in the same way as byte limit
This commit is contained in:
@@ -2125,6 +2125,10 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
|
|||||||
if (lead_features_count > 0) {
|
if (lead_features_count > 0) {
|
||||||
scaled_max_tile_size *= (lead_features_count + other_multiplier_cluster_features_count) / lead_features_count;
|
scaled_max_tile_size *= (lead_features_count + other_multiplier_cluster_features_count) / lead_features_count;
|
||||||
}
|
}
|
||||||
|
size_t scaled_max_tile_features = max_tile_features;
|
||||||
|
if (lead_features_count > 0) {
|
||||||
|
scaled_max_tile_features *= (lead_features_count + other_multiplier_cluster_features_count) / lead_features_count;
|
||||||
|
}
|
||||||
|
|
||||||
// Operations on the features within each layer:
|
// Operations on the features within each layer:
|
||||||
//
|
//
|
||||||
@@ -2465,13 +2469,13 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (totalsize > 0 && tile.layers.size() > 0) {
|
if (totalsize > 0 && tile.layers.size() > 0) {
|
||||||
if (totalsize > max_tile_features && !prevent[P_FEATURE_LIMIT]) {
|
if (totalsize > scaled_max_tile_features && !prevent[P_FEATURE_LIMIT]) {
|
||||||
if (totalsize > arg->feature_count_out) {
|
if (totalsize > arg->feature_count_out) {
|
||||||
arg->feature_count_out = totalsize;
|
arg->feature_count_out = totalsize;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!quiet) {
|
if (!quiet) {
|
||||||
fprintf(stderr, "tile %d/%u/%u has %zu features, >%zu \n", z, tx, ty, totalsize, max_tile_features);
|
fprintf(stderr, "tile %d/%u/%u has %zu features, >%zu \n", z, tx, ty, totalsize, scaled_max_tile_features);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (trying_to_stop_early && line_detail == first_detail) {
|
if (trying_to_stop_early && line_detail == first_detail) {
|
||||||
@@ -2497,7 +2501,7 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
|
|||||||
line_detail++; // to keep it the same when the loop decrements it
|
line_detail++; // to keep it the same when the loop decrements it
|
||||||
continue;
|
continue;
|
||||||
} else if (mingap < ULONG_MAX && (additional[A_DROP_DENSEST_AS_NEEDED] || additional[A_COALESCE_DENSEST_AS_NEEDED] || additional[A_CLUSTER_DENSEST_AS_NEEDED])) {
|
} 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 * max_tile_features / totalsize * 0.80;
|
mingap_fraction = mingap_fraction * scaled_max_tile_features / totalsize * 0.80;
|
||||||
unsigned long long m = choose_mingap(gaps, mingap_fraction, mingap);
|
unsigned long long m = choose_mingap(gaps, mingap_fraction, mingap);
|
||||||
if (m != mingap) {
|
if (m != mingap) {
|
||||||
mingap = m;
|
mingap = m;
|
||||||
@@ -2512,7 +2516,7 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
} else if (additional[A_DROP_SMALLEST_AS_NEEDED] || additional[A_COALESCE_SMALLEST_AS_NEEDED]) {
|
} else if (additional[A_DROP_SMALLEST_AS_NEEDED] || additional[A_COALESCE_SMALLEST_AS_NEEDED]) {
|
||||||
minextent_fraction = minextent_fraction * max_tile_features / totalsize * 0.75;
|
minextent_fraction = minextent_fraction * scaled_max_tile_features / totalsize * 0.75;
|
||||||
long long m = choose_minextent(extents, minextent_fraction, minextent);
|
long long m = choose_minextent(extents, minextent_fraction, minextent);
|
||||||
if (m != minextent) {
|
if (m != minextent) {
|
||||||
minextent = m;
|
minextent = m;
|
||||||
@@ -2530,7 +2534,7 @@ long long write_tile(decompressor *geoms, std::atomic<long long> *geompos_in, ch
|
|||||||
// The 95% is a guess to avoid too many retries
|
// The 95% is a guess to avoid too many retries
|
||||||
// and probably actually varies based on how much duplicated metadata there is
|
// and probably actually varies based on how much duplicated metadata there is
|
||||||
|
|
||||||
mindrop_sequence_fraction = mindrop_sequence_fraction * max_tile_features / totalsize * 0.95;
|
mindrop_sequence_fraction = mindrop_sequence_fraction * scaled_max_tile_features / totalsize * 0.95;
|
||||||
unsigned long long m = choose_mindrop_sequence(drop_sequences, mindrop_sequence_fraction, mindrop_sequence);
|
unsigned long long m = choose_mindrop_sequence(drop_sequences, mindrop_sequence_fraction, mindrop_sequence);
|
||||||
if (m != mindrop_sequence) {
|
if (m != mindrop_sequence) {
|
||||||
mindrop_sequence = m;
|
mindrop_sequence = m;
|
||||||
|
|||||||
Reference in New Issue
Block a user