From e507d8257492e6716bfe66c2e8c4cb69a211d8be Mon Sep 17 00:00:00 2001 From: Erica Fischer Date: Fri, 2 Feb 2024 11:23:15 -0800 Subject: [PATCH] Don't clip on read except in z0 --- tile.cpp | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/tile.cpp b/tile.cpp index 031678f2..2f9837f9 100644 --- a/tile.cpp +++ b/tile.cpp @@ -502,7 +502,7 @@ void rewrite(drawvec &geom, int z, int nextzoom, int maxzoom, long long *bbox, u // printf("%d/%d/%d: %lld,%lld <==\n", nextzoom, jx, jy, sf.geometry[0].x, sf.geometry[0].y); clip_to_tile(sf, nextzoom, buffer, false); - if (sf.geometry.size() > 0) { + if (sf.geometry.size() > 0) { // serialize_feature wants world coordinates, downscaled for (auto &g : sf.geometry) { g.x = SHIFT_RIGHT(g.x + (jx << (32 - nextzoom))); @@ -526,8 +526,8 @@ void rewrite(drawvec &geom, int z, int nextzoom, int maxzoom, long long *bbox, u geomfile[j]->serialize_long_long(feature.size(), &geompos[j], fname); geomfile[j]->fwrite_check(feature.c_str(), sizeof(char), feature.size(), &geompos[j], fname); } else { - printf("clipped away\n"); - } + // printf("clipped away\n"); + } } } } @@ -1638,9 +1638,11 @@ serial_feature next_feature(decompressor *geoms, std::atomic *geompos // printf("%d/%d/%d: %lld,%lld\n", z, tx, ty, sf.geometry[0].x, sf.geometry[0].y); - if (clip_to_tile(sf, z, buffer, true)) { - printf("clipped away in %d\n", z); - continue; + if (z == 0) { // in other zooms, features will have already been clipped + if (clip_to_tile(sf, z, buffer, true)) { + // printf("clipped away in %d\n", z); + continue; + } } if (sf.geometry.size() > 0) {