I want to add a marker on the OpenLayers map with a single-click event. and after adding a marker-> I want to remove this single-click event from the map.
Here is my on-add marker function :
let iconFeature = new OlFeature({
geometry: new OlPoint(event.coordinate),
name: 'Somewhere near Nottingham',
});
editLayer.getSource().addFeature(iconFeature);
};
This is single-click event:
map.on('singleclick', onAddMarker);
I tried this way, but not working
map.un('singleclick', onAddMarker);