From 3a94106283732c0ac5ce0e37033217bd76b94ca4 Mon Sep 17 00:00:00 2001 From: Eric Fischer Date: Wed, 30 Sep 2015 11:56:22 -0700 Subject: [PATCH] Don't write out tiles that have no features. --- tile-join.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tile-join.cc b/tile-join.cc index 8a4dd6a1..8acce369 100644 --- a/tile-join.cc +++ b/tile-join.cc @@ -95,6 +95,7 @@ void handle(std::string message, int z, unsigned x, unsigned y, struct pool **fi // https://github.com/mapbox/mapnik-vector-tile/blob/master/examples/c%2B%2B/tileinfo.cpp mapnik::vector::tile tile; mapnik::vector::tile outtile; + int features_added = 0; if (is_compressed(message)) { std::string uncompressed; @@ -278,6 +279,8 @@ void handle(std::string message, int z, unsigned x, unsigned y, struct pool **fi for (unsigned i = 0; i < feature_tags.size(); i++) { outfeature->add_tags(feature_tags[i]); } + + features_added++; } } @@ -301,6 +304,10 @@ void handle(std::string message, int z, unsigned x, unsigned y, struct pool **fi pool_free_strings(&values); } + if (features_added == 0) { + return; + } + std::string s; std::string compressed;