[ Whereis® API Home ] [ Developers' Guide ]

A default map has a full set of onscreen artefacts and map controls. You can modify the available controls by specifying a controls array as an option when instantiating the Map, or subsequently in a series of addControl() operations.

The following table lists some of the controls you may find useful.

Name

Description

EMS.Control.ContextMenu

Replaces the browsers right click context menu with a custom version that can trigger map events

EMS.Control.Copyright

Must be displayed on the map to comply with your licence

EMS.Control.DraggingControl

Enables you to create draggable objects, by reference to the OpenLayers superclass

OpenLayers.Control.KeyboardDefaults

Tests that current map coordinates are non-null and valid for use with the API

EMS.Control.NorthArrow

Directional indicator

EMS.Control.PanButton

Pan buttons

EMS.Control.Scale

Shows the current scale of the map

EMS.Control.ZoomBar

Displays a ZoomBar.

EMS.Control.LayerSwitcherDisplays a control for changing the layers. By default this shows all the map base layers.

If you specify one or more particular controls when you instantiate the map, your instruction overrides the default and only those controls that you have specified will be displayed.

For example, the following snippet generates a map with copyright symbol and scale bar, but nothing else.

var map = new EMS.Map("map-div", {
        "controls": [new EMS.Control.Scale(),
                     new EMS.Control.Copyright()]
});

By default, map controls are dynamic in size. If the map you are creating is small, use the fullsizeControls option as false to insert them at reduced size.

var map = new EMS.Map("map-div", {
        "fullsizeControls": true
});

Use extended constructors to further customise individual controls. For an example, see Pan.

NEXT PAGE

NOTES
Icon

To comply with your licence, ensure that every EMS map you generate includes a Copyright control.

Icon

For more information, see the JavaScript Command Reference and the following working example:

  • Mini controls