How can I remove standard controls in an OpenLayers-Map?

Viewed 23072

I use OpenLayers and want to create another navigation-control in the upper-left side. I know how to add Controls, but this navigation is added at default while creating the OpenLayers-Map. So I want to remove that Control, to add an own. I know already, that the default-control is an OpenLayers.Control.PanZoom.

3 Answers

Traverse the array of controls and then remove the zoom control

map.getControls().forEach(function(control) {
  if (control instanceof ol.control.Zoom) {
    map.removeControl(control);
  }
}, this);
Related