mirror of
https://github.com/mapbox/tippecanoe.git
synced 2025-01-22 12:28:03 +00:00
Fix the major bug: forgetting to offset back to world coordinates
This commit is contained in:
parent
b7b476b36c
commit
028fef470e
@ -212,7 +212,7 @@ struct pool_val *deserialize_string(char **f, struct pool *p, int type) {
|
|||||||
|
|
||||||
void check(int geomfd, off_t geom_size, char *metabase, unsigned *file_bbox, struct pool *file_keys, unsigned *midx, unsigned *midy, const char *layername, int maxzoom, int minzoom, sqlite3 *outdb, double droprate, int buffer, const char *fname, struct json_pull *jp, const char *tmpdir) {
|
void check(int geomfd, off_t geom_size, char *metabase, unsigned *file_bbox, struct pool *file_keys, unsigned *midx, unsigned *midy, const char *layername, int maxzoom, int minzoom, sqlite3 *outdb, double droprate, int buffer, const char *fname, struct json_pull *jp, const char *tmpdir) {
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < maxzoom; i++) {
|
for (i = 0; i <= maxzoom; i++) {
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
long long most = 0;
|
long long most = 0;
|
||||||
|
|
||||||
|
13
tile.cc
13
tile.cc
@ -370,7 +370,6 @@ long long write_tile(char **geoms, char *metabase, unsigned *file_bbox, int z, u
|
|||||||
while (1) {
|
while (1) {
|
||||||
int t;
|
int t;
|
||||||
deserialize_int(geoms, &t);
|
deserialize_int(geoms, &t);
|
||||||
printf("geometry %d\n", t);
|
|
||||||
if (t < 0) {
|
if (t < 0) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -420,6 +419,13 @@ long long write_tile(char **geoms, char *metabase, unsigned *file_bbox, int z, u
|
|||||||
within = 1;
|
within = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Offset from tile coordinates back to world coordinates
|
||||||
|
unsigned sx = 0, sy = 0;
|
||||||
|
if (z != 0) {
|
||||||
|
sx = tx << (32 - z);
|
||||||
|
sy = ty << (32 - z);
|
||||||
|
}
|
||||||
|
|
||||||
//printf("type %d, meta %lld\n", t, metastart);
|
//printf("type %d, meta %lld\n", t, metastart);
|
||||||
serialize_int(geomfile, t, &geompos, fname, jp);
|
serialize_int(geomfile, t, &geompos, fname, jp);
|
||||||
serialize_long_long(geomfile, metastart, &geompos, fname, jp);
|
serialize_long_long(geomfile, metastart, &geompos, fname, jp);
|
||||||
@ -428,8 +434,8 @@ long long write_tile(char **geoms, char *metabase, unsigned *file_bbox, int z, u
|
|||||||
serialize_byte(geomfile, geom[u].op, &geompos, fname, jp);
|
serialize_byte(geomfile, geom[u].op, &geompos, fname, jp);
|
||||||
|
|
||||||
if (geom[u].op != VT_CLOSEPATH) {
|
if (geom[u].op != VT_CLOSEPATH) {
|
||||||
serialize_uint(geomfile, geom[u].x, &geompos, fname, jp);
|
serialize_uint(geomfile, geom[u].x + sx, &geompos, fname, jp);
|
||||||
serialize_uint(geomfile, geom[u].y, &geompos, fname, jp);
|
serialize_uint(geomfile, geom[u].y + sy, &geompos, fname, jp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -548,6 +554,7 @@ long long write_tile(char **geoms, char *metabase, unsigned *file_bbox, int z, u
|
|||||||
evaluate(features, metabase, file_keys, layername, line_detail, compressed.size());
|
evaluate(features, metabase, file_keys, layername, line_detail, compressed.size());
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
printf("output %d/%u/%u\n", z, tx, ty);
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user