mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-06 02:15:41 +02:00
Quick reject by bounding box of linear features too small to draw
This commit is contained in:
@@ -445,6 +445,18 @@ void read_json(FILE *f, char *fname, char *layername, int maxzoom, int minzoom,
|
|||||||
unsigned cx = bbox[0] / 2 + bbox[2] / 2;
|
unsigned cx = bbox[0] / 2 + bbox[2] / 2;
|
||||||
unsigned cy = bbox[1] / 2 + bbox[3] / 2;
|
unsigned cy = bbox[1] / 2 + bbox[3] / 2;
|
||||||
|
|
||||||
|
int minzoom = 0;
|
||||||
|
if (mb_geometry[t] == VT_LINE) {
|
||||||
|
for (minzoom = 0; minzoom < 31; minzoom++) {
|
||||||
|
unsigned mask = 1 << (32 - (minzoom + 1));
|
||||||
|
|
||||||
|
if (((bbox[0] & mask) != (bbox[2] & mask)) ||
|
||||||
|
((bbox[1] & mask) != (bbox[3] & mask))) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* XXX do proper overlap instead of whole bounding box */
|
/* XXX do proper overlap instead of whole bounding box */
|
||||||
if (z == 0) {
|
if (z == 0) {
|
||||||
struct index ix;
|
struct index ix;
|
||||||
@@ -452,6 +464,7 @@ void read_json(FILE *f, char *fname, char *layername, int maxzoom, int minzoom,
|
|||||||
ix.fpos = start;
|
ix.fpos = start;
|
||||||
ix.type = mb_geometry[t];
|
ix.type = mb_geometry[t];
|
||||||
ix.maxzoom = z;
|
ix.maxzoom = z;
|
||||||
|
ix.minzoom = minzoom;
|
||||||
fwrite_check(&ix, sizeof(struct index), 1, indexfile, fname, jp);
|
fwrite_check(&ix, sizeof(struct index), 1, indexfile, fname, jp);
|
||||||
} else {
|
} else {
|
||||||
int pass;
|
int pass;
|
||||||
@@ -497,6 +510,7 @@ void read_json(FILE *f, char *fname, char *layername, int maxzoom, int minzoom,
|
|||||||
ix.type = mb_geometry[t];
|
ix.type = mb_geometry[t];
|
||||||
ix.maxzoom = z;
|
ix.maxzoom = z;
|
||||||
ix.candup = (instances > 1);
|
ix.candup = (instances > 1);
|
||||||
|
ix.minzoom = minzoom;
|
||||||
fwrite_check(&ix, sizeof(struct index), 1, indexfile, fname, jp);
|
fwrite_check(&ix, sizeof(struct index), 1, indexfile, fname, jp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -371,6 +371,9 @@ long long write_tile(struct index *start, struct index *end, char *metabase, uns
|
|||||||
if (z > i->maxzoom) {
|
if (z > i->maxzoom) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (z + line_detail <= i->minzoom) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (i->candup) {
|
if (i->candup) {
|
||||||
if (dup.count(i->fpos) != 0) {
|
if (dup.count(i->fpos) != 0) {
|
||||||
|
|||||||
@@ -20,8 +20,9 @@ struct pool_val *deserialize_string(char **f, struct pool *p, int type);
|
|||||||
|
|
||||||
struct index {
|
struct index {
|
||||||
unsigned long long index;
|
unsigned long long index;
|
||||||
long long fpos : 48;
|
long long fpos : 44;
|
||||||
int maxzoom : 8;
|
int maxzoom : 6;
|
||||||
|
int minzoom : 6;
|
||||||
int type : 7;
|
int type : 7;
|
||||||
int candup : 1;
|
int candup : 1;
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user