FIND OUT MORE

Display your business-critical information with confidence. Vicmap™ API – authoritative, current and clear.

Vicmap API Syntax

In this section the user is acquainted with the structure of the API and familiarised with its syntax.

Vicmap API uses the OpenLayers JavaScript library as the underlying code base. As such, Vicmap API is written in a class structure and therefore in order to create an object, the new keyword is used together with the function's name.

For instance, in our previous example we use:

var map = new OpenLayers.Vicmap.Map('map');
 

to create a new map object. This new map object will have all the predefined properties of the OpenLayers.Vicmap.Map class. The properties are documented in the JavaScript API documentation.

As a general rule of thumb, all arguments for the OpenLayers.Vicmap.Map class constructor can be specified, although the options parameters is optional. Nonetheless, when there is an exception to instantiating the class using its constructor, it will be specified explicitly in the JavaScript API documentation.

The options argument for the OpenLayers.Vicmap.Map object

 

The constructor for the OpenLayers.Vicmap.Map object takes an options argument, which is optional. If it is not specified, the OpenLayers.Vicmap.Map object is configured with the following 6 controls by default:

  • pan button
  • zoom button
  • pan via click-and-drag
  • zoom via double click
  • mouse position and layer switcher

If one wishes to omit the pan via click-and-drag and the zoom via double-clickcontrols from their application. They can achieve this using the code below:

var map = new OpenLayers.Vicmap.Mapvar map = new OpenLayers.Vicmap.Map('map',
    { controls: [ new OpenLayers.Control.PanZoomBar(),
                  new OpenLayers.Control.MousePosition({element: $('location')}),
                  new OpenLayers.Control.LayerSwitcher() ] }
);    
__________________________________________________________________________________________

Please refer to Understanding OpenLayers Syntax for background information regarding OpenLayers, which is the basis for Vicmap API.