Warn on rejected line geometry (#3088)
This commit is contained in:
@@ -86,7 +86,19 @@ void LineBucket::addGeometry(const GeometryCoordinates& coordinates,
|
||||
}();
|
||||
|
||||
// Ignore invalid geometry.
|
||||
if (len < (options.type == FeatureType::Polygon ? 3 : 2)) {
|
||||
const std::size_t minLen = (options.type == FeatureType::Polygon ? 3 : 2);
|
||||
if (len < minLen) {
|
||||
// Warn once, but only if the source geometry is invalid, not if de-duplication made it invalid.
|
||||
// This happens, e.g., when attempting to use a GeoJSON `MultiPoint`
|
||||
// or `MLNPointCollectionFeature` as the source for a line layer.
|
||||
// Unfortunately, we cannot show the layer or source name from here.
|
||||
if (coordinates.size() < minLen) {
|
||||
static bool warned = false; // not thread-safe, there's a small chance of warning more than once
|
||||
if (!warned) {
|
||||
warned = true;
|
||||
Log::Warning(Event::General, "Invalid geometry in line layer");
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user