Gzip -9 tiles. Don't bother writing tiles whose features all got clipped away.

This commit is contained in:
Eric Fischer
2014-11-20 14:33:45 -08:00
parent 82c0f67813
commit bb13dc03e5
+5 -1
View File
@@ -35,7 +35,7 @@ static inline int compress(std::string const& input, std::string& output) {
deflate_s.opaque = Z_NULL; deflate_s.opaque = Z_NULL;
deflate_s.avail_in = 0; deflate_s.avail_in = 0;
deflate_s.next_in = Z_NULL; deflate_s.next_in = Z_NULL;
deflateInit2(&deflate_s, Z_DEFAULT_COMPRESSION, Z_DEFLATED, 31, 8, Z_DEFAULT_STRATEGY); deflateInit2(&deflate_s, Z_BEST_COMPRESSION, Z_DEFLATED, 31, 8, Z_DEFAULT_STRATEGY);
deflate_s.next_in = (Bytef *)input.data(); deflate_s.next_in = (Bytef *)input.data();
deflate_s.avail_in = input.size(); deflate_s.avail_in = input.size();
size_t length = 0; size_t length = 0;
@@ -470,6 +470,7 @@ long long write_tile(struct index *start, struct index *end, char *metabase, uns
} }
} }
if (features.size() > 0) {
mapnik::vector::tile tile = create_tile(layername, line_detail, features, &count, &keys, &values); mapnik::vector::tile tile = create_tile(layername, line_detail, features, &count, &keys, &values);
pool_free(&keys); pool_free(&keys);
@@ -492,6 +493,9 @@ long long write_tile(struct index *start, struct index *end, char *metabase, uns
mbtiles_write_tile(outdb, z, tx, ty, compressed.data(), compressed.size()); mbtiles_write_tile(outdb, z, tx, ty, compressed.data(), compressed.size());
return count; return count;
} }
} else {
return count;
}
} }
fprintf(stderr, "could not make tile %d/%u/%u small enough\n", z, tx, ty); fprintf(stderr, "could not make tile %d/%u/%u small enough\n", z, tx, ty);