diff --git a/tile.cc b/tile.cc index b383902..d0e85c5 100644 --- a/tile.cc +++ b/tile.cc @@ -387,6 +387,9 @@ long long write_tile(char **geoms, char *metabase, unsigned *file_bbox, int z, u double scale = (double) (1LL << (64 - 2 * (z + 8))); double gap = 0; + long long original_features = 0; + long long unclipped_features = 0; + std::vector > features; for (i = 0; i < nlayers; i++) { features.push_back(std::vector()); @@ -423,6 +426,8 @@ long long write_tile(char **geoms, char *metabase, unsigned *file_bbox, int z, u oprogress = progress; } + original_features++; + int quick = quick_check(bbox, z, line_detail, buffer); if (quick == 0) { continue; @@ -442,6 +447,10 @@ long long write_tile(char **geoms, char *metabase, unsigned *file_bbox, int z, u geom = remove_noop(geom, t); } + if (geom.size() > 0) { + unclipped_features++; + } + if (line_detail == detail && fraction == 1) { /* only write out the next zoom once, even if we retry */ if (geom.size() > 0 && z + 1 <= file_maxzoom) { int j; @@ -654,6 +663,11 @@ long long write_tile(char **geoms, char *metabase, unsigned *file_bbox, int z, u } } + if (z == 0 && unclipped_features < original_features / 2) { + fprintf(stderr, "\n\nMore than half the features were clipped away at zoom level 0.\n"); + fprintf(stderr, "Is your data in the wrong projection? (Not WGS84/EPSG:4326)\n"); + } + long long totalsize = 0; for (j = 0; j < nlayers; j++) { totalsize += features[j].size();