I have a geojson featurecollection with 300 features added with:
for(var i = 0; myfeatures.length; i++) {
var promise = Cesium.GeoJsonDataSource.load(myfeatures[i]);
promise.then(function(dataSource) {
dataSource._name = “TESTFEATURE”
}
}
What is the right way to remove and hide all the features based on a property (in this case, ._name)?
The following works to only hide it, but not remove it:
var entities = viewer.dataSources;
for (var i = 0; i < entities.length; i++) {
var entity = entities._dataSources[i];
if(entities._dataSources[i].name == “TESTFEATURE”) {
viewer.dataSources._dataSources[i]._entityCollection._entities.values[0].show = false;
// viewer.dataSources.remove(entity); // when I uncomment out this line, it looks like Cesium only removes half of the features, and not all of them
}
Though I can get the features to hide, what is the proper way to remove all the feature’s I’ve added that match the condition that the _name is “TESTFEATURE”?