when working with arrays should use splice to remove elements

If you use delete on an array it doesnt update the index, so you have undefined elements, and a inaccurate length. Array.splice should be used to remove elements from arrays.

Without this change leaflet throws an error when adding the layer while iterating through the features array if features have been deleted instead of removed with splice.