隐藏太小的地图框图层形状

Hide mapbox layer shapes that are too small

我有一些 geoJSON 多边形,我通过地图顶部的图层进行渲染。根据形状本身和缩放级别,有时渲染的形状太小,甚至显示它们也没有意义。

有没有办法隐藏渲染面积小于某个数字的形状?

所以,作为 Babis.amas suggested, first I calculate the area of the feature with help of turf.area. It gives the value in square meters. Then I convert this value to pixels using the function mentioned here. 然后它真的取决于我正在处理的形状类型。如果认为形状太小无法渲染,我就是不将其添加到图层数据特征集合中。