mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-06 02:15:41 +02:00
Make duplicate trimming less bad: only trim features indexed >1 time
This commit is contained in:
@@ -448,6 +448,10 @@ void read_json(FILE *f, char *fname, char *layername, int maxzoom, int minzoom,
|
|||||||
ix.maxzoom = z;
|
ix.maxzoom = z;
|
||||||
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 instances = 0;
|
||||||
|
|
||||||
|
for (pass = 0; pass < 2; pass++) {
|
||||||
for (z = maxzoom; z >= 1; z--) {
|
for (z = maxzoom; z >= 1; z--) {
|
||||||
unsigned x, y;
|
unsigned x, y;
|
||||||
for (x = (bbox[0] - (buffer << (32 - z - 8))) >> (32 - z); x <= (bbox[2] + (buffer << (32 - z - 8))) >> (32 - z); x++) {
|
for (x = (bbox[0] - (buffer << (32 - z - 8))) >> (32 - z); x <= (bbox[2] + (buffer << (32 - z - 8))) >> (32 - z); x++) {
|
||||||
@@ -470,6 +474,12 @@ void read_json(FILE *f, char *fname, char *layername, int maxzoom, int minzoom,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pass == 0) {
|
||||||
|
instances++;
|
||||||
|
if (instances > 1) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
struct index ix;
|
struct index ix;
|
||||||
|
|
||||||
if (x == cx >> (32 - z) && y == cy >> (32 - z)) {
|
if (x == cx >> (32 - z) && y == cy >> (32 - z)) {
|
||||||
@@ -480,11 +490,14 @@ 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.candup = (instances > 1);
|
||||||
fwrite_check(&ix, sizeof(struct index), 1, indexfile, fname, jp);
|
fwrite_check(&ix, sizeof(struct index), 1, indexfile, fname, jp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < 2; i++) {
|
for (i = 0; i < 2; i++) {
|
||||||
if (bbox[i] < file_bbox[i]) {
|
if (bbox[i] < file_bbox[i]) {
|
||||||
|
|||||||
@@ -371,10 +371,12 @@ long long write_tile(struct index *start, struct index *end, char *metabase, uns
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (i->candup) {
|
||||||
if (dup.count(i->fpos) != 0) {
|
if (dup.count(i->fpos) != 0) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
dup.insert(std::pair<long long, int>(i->fpos, 1));
|
dup.insert(std::pair<long long, int>(i->fpos, 1));
|
||||||
|
}
|
||||||
|
|
||||||
int t = i->type;
|
int t = i->type;
|
||||||
if (t == VT_POINT) {
|
if (t == VT_POINT) {
|
||||||
|
|||||||
@@ -22,7 +22,8 @@ struct index {
|
|||||||
unsigned long long index;
|
unsigned long long index;
|
||||||
long long fpos : 48;
|
long long fpos : 48;
|
||||||
int maxzoom : 8;
|
int maxzoom : 8;
|
||||||
int type : 8;
|
int type : 7;
|
||||||
|
int candup : 1;
|
||||||
};
|
};
|
||||||
|
|
||||||
long long write_tile(struct index *start, struct index *end, char *metabase, unsigned *file_bbox, int z, unsigned x, unsigned y, int detail, int basezoom, struct pool *file_keys, char *layername, sqlite3 *outdb, double droprate, int buffer);
|
long long write_tile(struct index *start, struct index *end, char *metabase, unsigned *file_bbox, int z, unsigned x, unsigned y, int detail, int basezoom, struct pool *file_keys, char *layername, sqlite3 *outdb, double droprate, int buffer);
|
||||||
|
|||||||
Reference in New Issue
Block a user