mirror of
https://github.com/mapbox/tippecanoe.git
synced 2025-04-16 15:09:01 +00:00
Experiment with enabling simultaneous -densest and -fraction
This commit is contained in:
parent
03577cf967
commit
578345997b
42
tile.cpp
42
tile.cpp
@ -1596,23 +1596,27 @@ long long write_tile(FILE *geoms, long long *geompos_in, char *metabase, char *s
|
||||
|
||||
clustered = 0;
|
||||
}
|
||||
} else if (additional[A_DROP_DENSEST_AS_NEEDED]) {
|
||||
}
|
||||
if (additional[A_DROP_DENSEST_AS_NEEDED]) {
|
||||
indices.push_back(sf.index);
|
||||
if (sf.index - merge_previndex < mingap) {
|
||||
continue;
|
||||
}
|
||||
} else if (additional[A_COALESCE_DENSEST_AS_NEEDED]) {
|
||||
}
|
||||
if (additional[A_COALESCE_DENSEST_AS_NEEDED]) {
|
||||
indices.push_back(sf.index);
|
||||
if (sf.index - merge_previndex < mingap) {
|
||||
coalesced_geometry.push_back(sf);
|
||||
continue;
|
||||
}
|
||||
} else if (additional[A_DROP_SMALLEST_AS_NEEDED]) {
|
||||
}
|
||||
if (additional[A_DROP_SMALLEST_AS_NEEDED]) {
|
||||
extents.push_back(sf.extent);
|
||||
if (sf.extent + coalesced_area <= minextent && sf.t != VT_POINT) {
|
||||
continue;
|
||||
}
|
||||
} else if (additional[A_COALESCE_SMALLEST_AS_NEEDED]) {
|
||||
}
|
||||
if (additional[A_COALESCE_SMALLEST_AS_NEEDED]) {
|
||||
extents.push_back(sf.extent);
|
||||
if (sf.extent + coalesced_area <= minextent) {
|
||||
coalesced_geometry.push_back(sf);
|
||||
@ -2089,7 +2093,35 @@ long long write_tile(FILE *geoms, long long *geompos_in, char *metabase, char *s
|
||||
fprintf(stderr, "tile %d/%u/%u size is %lld with detail %d, >%zu \n", z, tx, ty, (long long) compressed.size(), line_detail, max_tile_size);
|
||||
}
|
||||
|
||||
if (has_polygons && additional[A_MERGE_POLYGONS_AS_NEEDED] && merge_fraction > .05 && merge_successful) {
|
||||
if (additional[A_COALESCE_DENSEST_AS_NEEDED] && additional[A_COALESCE_FRACTION_AS_NEEDED]) {
|
||||
mingap_fraction = mingap_fraction * max_tile_size / compressed.size() * 0.90;
|
||||
unsigned long long mg = choose_mingap(indices, mingap_fraction);
|
||||
if (mg <= mingap) {
|
||||
mg = mingap * 1.5;
|
||||
}
|
||||
mingap = mg;
|
||||
if (mingap > arg->mingap_out) {
|
||||
arg->mingap_out = mingap;
|
||||
arg->still_dropping = true;
|
||||
}
|
||||
if (!quiet) {
|
||||
fprintf(stderr, "Going to try keeping the sparsest %0.2f%% of the features to make it fit\n", mingap_fraction * 100.0);
|
||||
}
|
||||
|
||||
// The 95% is a guess to avoid too many retries
|
||||
// and probably actually varies based on how much duplicated metadata there is
|
||||
|
||||
fraction = fraction * max_tile_size / compressed.size() * 0.95;
|
||||
if (!quiet) {
|
||||
fprintf(stderr, "Going to try keeping %0.2f%% of the features to make it fit\n", fraction * 100);
|
||||
}
|
||||
if ((additional[A_DROP_FRACTION_AS_NEEDED] || additional[A_COALESCE_FRACTION_AS_NEEDED]) && fraction < arg->fraction_out) {
|
||||
arg->fraction_out = fraction;
|
||||
arg->still_dropping = true;
|
||||
}
|
||||
|
||||
line_detail++;
|
||||
} else if (has_polygons && additional[A_MERGE_POLYGONS_AS_NEEDED] && merge_fraction > .05 && merge_successful) {
|
||||
merge_fraction = merge_fraction * max_tile_size / compressed.size() * 0.95;
|
||||
if (!quiet) {
|
||||
fprintf(stderr, "Going to try merging %0.2f%% of the polygons to make it fit\n", 100 - merge_fraction * 100);
|
||||
|
Loading…
x
Reference in New Issue
Block a user