mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-04 09:25:41 +02:00
Take another opportunity to simplify lines after coalescing features
This commit is contained in:
@@ -662,6 +662,7 @@ struct coalesce {
|
|||||||
std::vector<int> meta;
|
std::vector<int> meta;
|
||||||
unsigned long long index;
|
unsigned long long index;
|
||||||
char *metasrc;
|
char *metasrc;
|
||||||
|
bool coalesced;
|
||||||
|
|
||||||
bool operator< (const coalesce &o) const {
|
bool operator< (const coalesce &o) const {
|
||||||
int cmp = coalindexcmp(this, &o);
|
int cmp = coalindexcmp(this, &o);
|
||||||
@@ -952,6 +953,7 @@ long long write_tile(struct index *start, struct index *end, char *metabase, uns
|
|||||||
c.index = i->index;
|
c.index = i->index;
|
||||||
c.geom = geom;
|
c.geom = geom;
|
||||||
c.metasrc = meta;
|
c.metasrc = meta;
|
||||||
|
c.coalesced = false;
|
||||||
|
|
||||||
decode_meta(&meta, &keys, &values, file_keys, &c.meta, NULL);
|
decode_meta(&meta, &keys, &values, file_keys, &c.meta, NULL);
|
||||||
features.push_back(c);
|
features.push_back(c);
|
||||||
@@ -974,12 +976,20 @@ long long write_tile(struct index *start, struct index *end, char *metabase, uns
|
|||||||
for (z = 0; z < features[x].geom.size(); z++) {
|
for (z = 0; z < features[x].geom.size(); z++) {
|
||||||
out[y].geom.push_back(features[x].geom[z]);
|
out[y].geom.push_back(features[x].geom[z]);
|
||||||
}
|
}
|
||||||
|
out[y].coalesced = true;
|
||||||
} else {
|
} else {
|
||||||
out.push_back(features[x]);
|
out.push_back(features[x]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
features = out;
|
features = out;
|
||||||
|
|
||||||
|
for (x = 0; x < features.size(); x++) {
|
||||||
|
if (features[x].coalesced && features[x].type == VT_LINE) {
|
||||||
|
features[x].geom = remove_noop(features[x].geom, features[x].type);
|
||||||
|
features[x].geom = simplify_lines(features[x].geom, 32, 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
mapnik::vector::tile tile = create_tile(layername, line_detail, features, &count, &keys, &values);
|
mapnik::vector::tile tile = create_tile(layername, line_detail, features, &count, &keys, &values);
|
||||||
|
|
||||||
pool_free(&keys);
|
pool_free(&keys);
|
||||||
|
|||||||
Reference in New Issue
Block a user