Make -Z0 work again for file minimum zoom

This commit is contained in:
Eric Fischer 2014-12-17 11:05:14 -08:00
parent c90ba8511f
commit ad17f1f282
3 changed files with 12 additions and 8 deletions

View File

@ -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;

16
tile.cc
View File

@ -342,7 +342,7 @@ void evaluate(std::vector<coalesce> &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;
}

2
tile.h
View File

@ -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);