Low zooms are OK now; medium zooms are still dropping sometimes

This commit is contained in:
Erica Fischer
2023-09-26 12:39:21 -07:00
parent f7dc7faf31
commit 581b61f9aa
3 changed files with 84 additions and 3 deletions
+14 -3
View File
@@ -609,6 +609,8 @@ void *partial_feature_worker(void *v) {
int out_detail = (*partials)[i].extra_detail;
drawvec geom = (*partials)[i].geoms[0];
drawvec before_scaling = geom;
to_tile_scale(geom, z, out_detail);
if (t == VT_POLYGON) {
@@ -622,10 +624,19 @@ void *partial_feature_worker(void *v) {
check_polygon(geom);
}
if (geom.size() < 3) {
if (geom.size() < 4) {
if (area > 0) {
// area is in world coordinates, calculated before scaling down
geom = revive_polygon(before, area, z, out_detail);
// Try reviving the polygon by buffering it outward a little
geom = buffer_poly(before_scaling, (1LL << (32 - z - out_detail)) * 1.0);
to_tile_scale(geom, z, out_detail);
geom = clean_or_clip_poly(geom, 0, 0, false, true);
if (geom.size() < 4) {
// OK, that didn't work, make a placeholder
// area is in world coordinates, calculated before scaling down
geom = revive_polygon(before, area, z, out_detail);
}
} else {
geom.clear();
}