I have a featureCollection
. Each element has properties
which again has the entry arr
. arr
either contains []
, or ["a",.... n]
. I want to remove every element from the featureCollection
where arr.length !== 0
.
How would I do that in turf.js
(version 5.1.6)?
Is there a inherent function for that? Or would I have to use simple dict
mutation, native to JS
?
As of v5.1.6 of TurfJS there is no function for filtering featureCollections by feature properties in TurfJS.
For this sort of thing just use native javascript functions like array filter method as suggested by @Rajesh.
var matchingFeatures = featureCollection.features.filter(function (feature){
return feature.properties.arr.length === 0
})