[OpenLayers-Users] How to remove the default blue PanZoom control - explained

Jan Henrik Øverland janhenrik.overland at gmail.com
Sat Sep 5 02:42:52 EDT 2009


Hi,

I get a lot of questions from people trying to remove the default PanZoom
map control. I recommend this solution:

The following controls are given to the map by default:

   - OpenLayers.Control.Navigation<http://dev.openlayers.org/docs/files/OpenLayers/Control/Navigation-js.html#OpenLayers.Control.Navigation>
   - OpenLayers.Control.PanZoom<http://dev.openlayers.org/docs/files/OpenLayers/Control/PanZoom-js.html#OpenLayers.Control.PanZoom>
   - OpenLayers.Control.ArgParser<http://dev.openlayers.org/docs/files/OpenLayers/Control/ArgParser-js.html#OpenLayers.Control.ArgParser>
   - OpenLayers.Control.Attribution<http://dev.openlayers.org/docs/files/OpenLayers/Control/Attribution-js.html#OpenLayers.Control.Attribution>

Instead of removing the PanZoom control, simply leave it out from the map
options at construction:

map = new OpenLayers.Map('your_element_id', {
        controls: [
            new OpenLayers.Control.Navigation(),
            new OpenLayers.Control.ArgParser(),
            new OpenLayers.Control.Attribution()
        ]
});

Jan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20090905/f396a35b/attachment.html


More information about the Users mailing list