Adding controls to your map
There are two methods for adding controls to a map.
Pass in a JavaScript array of OpenLayers Control objects when you instantiate the map object.
Add controls to the map object after it has been created by calling either of the two map functions
addControl()
, passing in a single control object, oraddControls()
, passing in an array of control objects.
When you create your map, four control objects are added automatically. These four controls are:
OpenLayers.Control.Navigation
: Responsible for handling map interaction from mouse events, such as dragging the mouse, zooming with the scroll bar, and double-clicking.OpenLayers.Control.PanZoom
: Adds a Pan/Zoom bar to the top left hand side of the map. Contains up/down/left/right arrows for panning, and zoom in, zoom out, and zoom to maximum map extent buttons for zooming.OpenLayers.Control.ArgParser
: Allows the map to zoom to a specific location and turn on/off layers based on the URL that you call the map with. In other...