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.
I use OpenLayers and want to create another navigation-control in the upper-left side. I
Share
The map object has a property called
controlsthat is an array ofOpenLayers.Controlobjects. If this property is not explicitly set then OpenLayers will assume that you want the default control set, includingOpenLayers.Control.Navigation(),OpenLayers.Control.PanZoom(),OpenLayers.Control.ArgParser(), andOpenLayers.Control.Attribution().To remove
PanZoomor any other default control, simply set thecontrolsproperty array at the time you construct theMapobject. Here is a code example:Here is a live example.
Please note that by setting the
controlsproperty that you will not get anyControlobjects be default. Any controls you need must be added manually.Here is a link to the source code of the
Mapobject if you want to see how it works for yourself.