mirror of
https://github.com/mapbox/tippecanoe.git
synced 2025-02-08 12:00:26 +00:00
Don't keep tilestats for features that are filtered out in tile-join
This commit is contained in:
parent
97d0b2a1b5
commit
855e344552
@ -550,7 +550,7 @@ std::map<std::string, layermap_entry> merge_layermaps(std::vector<std::map<std::
|
|||||||
} else {
|
} else {
|
||||||
for (auto val : fk->second.sample_values) {
|
for (auto val : fk->second.sample_values) {
|
||||||
auto pt = std::lower_bound(fk2->second.sample_values.begin(), fk2->second.sample_values.end(), val);
|
auto pt = std::lower_bound(fk2->second.sample_values.begin(), fk2->second.sample_values.end(), val);
|
||||||
if (pt == fk2->second.sample_values.end() || *pt != val) { // not found
|
if (pt == fk2->second.sample_values.end() || *pt != val) { // not found
|
||||||
fk2->second.sample_values.insert(pt, val);
|
fk2->second.sample_values.insert(pt, val);
|
||||||
|
|
||||||
if (fk2->second.sample_values.size() > 1000) {
|
if (fk2->second.sample_values.size() > 1000) {
|
||||||
@ -610,7 +610,7 @@ void add_to_file_keys(std::map<std::string, type_and_string_stats> &file_keys, s
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto pt = std::lower_bound(fka->second.sample_values.begin(), fka->second.sample_values.end(), val);
|
auto pt = std::lower_bound(fka->second.sample_values.begin(), fka->second.sample_values.end(), val);
|
||||||
if (pt == fka->second.sample_values.end() || *pt != val) { // not found
|
if (pt == fka->second.sample_values.end() || *pt != val) { // not found
|
||||||
fka->second.sample_values.insert(pt, val);
|
fka->second.sample_values.insert(pt, val);
|
||||||
|
|
||||||
if (fka->second.sample_values.size() > 1000) {
|
if (fka->second.sample_values.size() > 1000) {
|
||||||
|
@ -14,7 +14,7 @@ struct type_and_string {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct type_and_string_stats {
|
struct type_and_string_stats {
|
||||||
std::vector<type_and_string> sample_values; // sorted
|
std::vector<type_and_string> sample_values; // sorted
|
||||||
double min = INFINITY;
|
double min = INFINITY;
|
||||||
double max = -INFINITY;
|
double max = -INFINITY;
|
||||||
int type = 0;
|
int type = 0;
|
||||||
|
File diff suppressed because one or more lines are too long
@ -105,6 +105,8 @@ void handle(std::string message, int z, unsigned x, unsigned y, std::map<std::st
|
|||||||
mvt_feature outfeature;
|
mvt_feature outfeature;
|
||||||
int matched = 0;
|
int matched = 0;
|
||||||
|
|
||||||
|
std::map<std::string, type_and_string> for_tilestats;
|
||||||
|
|
||||||
if (feat.has_id) {
|
if (feat.has_id) {
|
||||||
outfeature.has_id = true;
|
outfeature.has_id = true;
|
||||||
outfeature.id = feat.id;
|
outfeature.id = feat.id;
|
||||||
@ -158,7 +160,7 @@ void handle(std::string message, int z, unsigned x, unsigned y, std::map<std::st
|
|||||||
tas.type = type;
|
tas.type = type;
|
||||||
tas.string = value;
|
tas.string = value;
|
||||||
|
|
||||||
add_to_file_keys(file_keys->second.file_keys, key, tas);
|
for_tilestats.insert(std::pair<std::string, type_and_string>(key, tas));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (header.size() > 0 && strcmp(key, header[0].c_str()) == 0) {
|
if (header.size() > 0 && strcmp(key, header[0].c_str()) == 0) {
|
||||||
@ -210,7 +212,7 @@ void handle(std::string message, int z, unsigned x, unsigned y, std::map<std::st
|
|||||||
tas.type = outval.type;
|
tas.type = outval.type;
|
||||||
tas.string = joinval;
|
tas.string = joinval;
|
||||||
|
|
||||||
add_to_file_keys(file_keys->second.file_keys, joinkey, tas);
|
for_tilestats.insert(std::pair<std::string, type_and_string>(joinkey, tas));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -241,6 +243,10 @@ void handle(std::string message, int z, unsigned x, unsigned y, std::map<std::st
|
|||||||
features_added++;
|
features_added++;
|
||||||
outlayer.features.push_back(outfeature);
|
outlayer.features.push_back(outfeature);
|
||||||
|
|
||||||
|
for (auto attr : for_tilestats) {
|
||||||
|
add_to_file_keys(file_keys->second.file_keys, attr.first, attr.second);
|
||||||
|
}
|
||||||
|
|
||||||
if (z < file_keys->second.minzoom) {
|
if (z < file_keys->second.minzoom) {
|
||||||
file_keys->second.minzoom = z;
|
file_keys->second.minzoom = z;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user