Use lower resolution at lower zooms. Not sure it's worth it.

This commit is contained in:
Eric Fischer 2014-09-23 10:57:01 -07:00
parent 7bb79dab8e
commit 00a42796b4
3 changed files with 7 additions and 9 deletions

View File

@ -334,7 +334,7 @@ void check(struct index *ix, long long n, char *metabase, unsigned *file_bbox) {
printf("%d/%u/%u %x %x %lld to %lld\n", z, tx, ty, wx, wy, (long long)(i - ix), (long long)(j - ix));
write_tile(i, j, metabase, file_bbox, z, tx, ty);
write_tile(i, j, metabase, file_bbox, z, tx, ty, z == 14 ? 12 : 10);
}
}
}

12
tile.cc
View File

@ -12,9 +12,6 @@ extern "C" {
#include "tile.h"
}
#define XMAX 4096
#define YMAX 4096
#define CMD_BITS 3
// https://github.com/mapbox/mapnik-vector-tile/blob/master/src/vector_tile_compression.hpp
@ -46,7 +43,7 @@ static inline int compress(std::string const& input, std::string& output) {
}
void write_tile(struct index *start, struct index *end, char *metabase, unsigned *file_bbox, int z, unsigned tx, unsigned ty) {
void write_tile(struct index *start, struct index *end, char *metabase, unsigned *file_bbox, int z, unsigned tx, unsigned ty, int detail) {
GOOGLE_PROTOBUF_VERIFY_VERSION;
mapnik::vector::tile tile;
@ -54,7 +51,8 @@ void write_tile(struct index *start, struct index *end, char *metabase, unsigned
layer->set_name("name");
layer->set_version(1);
layer->set_extent(XMAX);
layer->set_extent(1 << detail);
struct pool keys;
keys.n = 0;
@ -124,8 +122,8 @@ void write_tile(struct index *start, struct index *end, char *metabase, unsigned
wwy -= ty << (32 - z);
}
wwx >>= (32 - 12 - z);
wwy >>= (32 - 12 - z);
wwx >>= (32 - detail - z);
wwy >>= (32 - detail - z);
int dx = wwx - px;
int dy = wwy - py;

2
tile.h
View File

@ -47,4 +47,4 @@ struct index {
};
void write_tile(struct index *start, struct index *end, char *metabase, unsigned *file_bbox, int z, unsigned x, unsigned y);
void write_tile(struct index *start, struct index *end, char *metabase, unsigned *file_bbox, int z, unsigned x, unsigned y, int detail);