从 featureCollection turf.js 中删除特征

Remove feature from featureCollection turf.js

我有一个featureCollection。每个元素都有 properties,它也有条目 arrarr 包含 [],或 ["a",.... n]。我想从 featureCollection 中删除每个元素,其中 arr.length !== 0.

我如何在 turf.js(5.1.6 版)中做到这一点? 有一个固有的功能吗?还是我必须使用简单的 dict 突变,原生于 JS

从 TurfJS v5.1.6 开始,TurfJS 中没有通过特征属性过滤 featureCollections 的功能。

对于这种事情,只需使用@Rajesh 建议的原生 javascript 函数,如 array filter method

var matchingFeatures = featureCollection.features.filter(function (feature){ 
   return feature.properties.arr.length === 0 
})