From ad17f1f282f65b42f9a57f04843a1851d0db67a9 Mon Sep 17 00:00:00 2001 From: Eric Fischer Date: Wed, 17 Dec 2014 11:05:14 -0800 Subject: [PATCH] Make -Z0 work again for file minimum zoom --- geojson.c | 2 +- tile.cc | 16 ++++++++++------ tile.h | 2 +- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/geojson.c b/geojson.c index f607b19..f0dbbb1 100644 --- a/geojson.c +++ b/geojson.c @@ -283,7 +283,7 @@ void check(int geomfd[4], off_t geom_size[4], char *metabase, unsigned *file_bbo fprintf(stderr, " %3.1f%% %d/%u/%u \r", (((geom - geomstart + along) / (double) todo) + z) / (maxzoom + 1) * 100, z, x, y); - long long len = write_tile(&geom, metabase, file_bbox, z, x, y, z == maxzoom ? full_detail : low_detail, maxzoom, file_keys, layername, outdb, droprate, buffer, fname, jp, sub); + long long len = write_tile(&geom, metabase, file_bbox, z, x, y, z == maxzoom ? full_detail : low_detail, maxzoom, file_keys, layername, outdb, droprate, buffer, fname, jp, sub, minzoom); if (z == maxzoom && len > most) { *midx = x; diff --git a/tile.cc b/tile.cc index eadf4e4..8a54d4e 100644 --- a/tile.cc +++ b/tile.cc @@ -342,7 +342,7 @@ void evaluate(std::vector &features, char *metabase, struct pool *file pool_free(&keys); } -long long write_tile(char **geoms, char *metabase, unsigned *file_bbox, int z, unsigned tx, unsigned ty, int detail, int basezoom, struct pool *file_keys, const char *layername, sqlite3 *outdb, double droprate, int buffer, const char *fname, json_pull *jp, FILE *geomfile[4]) { +long long write_tile(char **geoms, char *metabase, unsigned *file_bbox, int z, unsigned tx, unsigned ty, int detail, int basezoom, struct pool *file_keys, const char *layername, sqlite3 *outdb, double droprate, int buffer, const char *fname, json_pull *jp, FILE *geomfile[4], int file_minzoom) { int line_detail; static bool evaluated = false; @@ -390,8 +390,8 @@ long long write_tile(char **geoms, char *metabase, unsigned *file_bbox, int z, u drawvec geom = decode_geometry(geoms, z, tx, ty, line_detail, bbox); - signed char minzoom; - deserialize_byte(geoms, &minzoom); + signed char feature_minzoom; + deserialize_byte(geoms, &feature_minzoom); int quick = quick_check(bbox, z, line_detail, buffer); if (quick == 0) { @@ -473,14 +473,18 @@ long long write_tile(char **geoms, char *metabase, unsigned *file_bbox, int z, u } serialize_byte(geomfile[j], VT_END, &geompos[j], fname, jp); - serialize_byte(geomfile[j], minzoom, &geompos[j], fname, jp); + serialize_byte(geomfile[j], feature_minzoom, &geompos[j], fname, jp); } } } } - if ((t == VT_LINE && z + line_detail <= minzoom) || - (t == VT_POINT && z < minzoom)) { + if (z < file_minzoom) { + continue; + } + + if ((t == VT_LINE && z + line_detail <= feature_minzoom) || + (t == VT_POINT && z < feature_minzoom)) { continue; } diff --git a/tile.h b/tile.h index 51451b0..98090db 100644 --- a/tile.h +++ b/tile.h @@ -36,4 +36,4 @@ struct index { int candup : 1; }; -long long write_tile(char **geom, char *metabase, unsigned *file_bbox, int z, unsigned x, unsigned y, int detail, int basezoom, struct pool *file_keys, const char *layername, sqlite3 *outdb, double droprate, int buffer, const char *fname, struct json_pull *jp, FILE *geomfile[4]); +long long write_tile(char **geom, char *metabase, unsigned *file_bbox, int z, unsigned x, unsigned y, int detail, int basezoom, struct pool *file_keys, const char *layername, sqlite3 *outdb, double droprate, int buffer, const char *fname, struct json_pull *jp, FILE *geomfile[4], int file_minzoom);