I am using OpenLayers 5 and i have a map which has multiple icons. When i try to remove an icon from my map, all the icons disappear at once.

Code Below is to add the vector source which contains all the feature in the map.

this.vectorSource = new VectorSource({
  features: this.iconArr,
  wrapX: false,
  let markerVectorLayer = new vectorLayer({
    source: this.vectorSource,

Code Below is removing a feature and adding a new one!!, Also all the features only disappear when i try to add the new feature in the coordinate of the previously removed feature. I also checked if the feature still exists in the vector source but it does not.


Everything is fine when the feature is removed. However, After the new feature is added, every feature from the map disappears at once. How do i fix this issue ?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.