According to wiki, when dynamically removing features we need to use:
We can also use:
which implicitly calls
parcel.removeFeature() method in the implementation.
When we use this method it removes the feature, but also all the features which are positioned after it in the internal featuresList. This makes is tricky or impossible removing a single specific feature dynamically without unintentionally removing other features too. I think the issue is in the following line inside the
Using splice in this way removes all features starting from index
e. Fix could be specifying the number of elements to remove in the splice method, in this case only one: