mirror of
https://github.com/felt/tippecanoe.git
synced 2026-10-05 18:05:42 +02:00
Avoid crash if the first bin gets clipped away
This commit is contained in:
@@ -1299,7 +1299,8 @@ static void handle_closepath_from_mvt(drawvec &geom) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void feature_out(std::vector<tile_feature> const &features, mvt_layer &outlayer,
|
// returns true if a feature was output; false if it was clipped away
|
||||||
|
static bool feature_out(std::vector<tile_feature> const &features, mvt_layer &outlayer,
|
||||||
std::set<std::string> const &keep,
|
std::set<std::string> const &keep,
|
||||||
std::set<std::string> const &exclude,
|
std::set<std::string> const &exclude,
|
||||||
std::vector<std::string> const &exclude_prefix,
|
std::vector<std::string> const &exclude_prefix,
|
||||||
@@ -1427,7 +1428,10 @@ static void feature_out(std::vector<tile_feature> const &features, mvt_layer &ou
|
|||||||
}
|
}
|
||||||
|
|
||||||
outlayer.features.push_back(std::move(outfeature));
|
outlayer.features.push_back(std::move(outfeature));
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct preservecmp {
|
static struct preservecmp {
|
||||||
@@ -1719,21 +1723,22 @@ mvt_tile assign_to_bins(mvt_tile &features,
|
|||||||
|
|
||||||
for (size_t i = 0; i < outfeatures.size(); i++) {
|
for (size_t i = 0; i < outfeatures.size(); i++) {
|
||||||
if (outfeatures[i].size() > 1) {
|
if (outfeatures[i].size() > 1) {
|
||||||
feature_out(outfeatures[i], outlayer,
|
if (feature_out(outfeatures[i], outlayer,
|
||||||
keep, exclude, exclude_prefix, attribute_accum,
|
keep, exclude, exclude_prefix, attribute_accum,
|
||||||
accumulate_numeric, key_pool, buffer);
|
accumulate_numeric, key_pool, buffer)) {
|
||||||
mvt_feature &nfeature = outlayer.features.back();
|
mvt_feature &nfeature = outlayer.features.back();
|
||||||
mvt_value val;
|
mvt_value val;
|
||||||
val.type = mvt_uint;
|
val.type = mvt_uint;
|
||||||
val.numeric_value.uint_value = outfeatures[i].size() - 1;
|
val.numeric_value.uint_value = outfeatures[i].size() - 1;
|
||||||
|
|
||||||
std::string attrname;
|
std::string attrname;
|
||||||
if (accumulate_numeric.size() == 0) {
|
if (accumulate_numeric.size() == 0) {
|
||||||
attrname = "tippecanoe:count";
|
attrname = "tippecanoe:count";
|
||||||
} else {
|
} else {
|
||||||
attrname = accumulate_numeric + ":count";
|
attrname = accumulate_numeric + ":count";
|
||||||
|
}
|
||||||
|
outlayer.tag(nfeature, attrname, val);
|
||||||
}
|
}
|
||||||
outlayer.tag(nfeature, attrname, val);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user