Defined in WebMapJS.js.

The global method setBaseURL(<location to webmapjs>) needs to be set prior the WMJSMap class can be used:


A new WMJSMap can be created by calling:

var webMapJS  = new WMJSMap(document.getElementById('mymap'));


  • WMJSMap(element) - constructor, add a div element as argument. The map will be rendered into this map
  • addBaseLayers(layer[]) - Adds new layers as baselayer
  • addLayer(layer) - Adds a WMJSLayer object to the map.
  • addListener(name,function,keep) - Add a listener with a name and callback function. If keep is undefined or false the listener is called once and then removed.
  • deleteLayer(layer) - Removes this layer from the map
  • disableLayer(layer) - Hides and deactivates the layer
  • draw(animationList) - Draws the map, with optionally an animationlist, this is an array of elements with the dimension name and its corresponding value. e.g. animationList = [{name:'time',value:'2013-01-01T00:00:00Z'},{name:'time',value:'2013-01-02T00:00:00Z'}];
  • enableLayer() - Displays and enables the layer
  • getBaseElement() - Returns the base element of the map
  • getBaseLayers() - Returns an array with the base layers
  • getDimension(name) - Returns the dimension with the given name
  • getDimensionList() - Returns an array with all map dimensions for all layers
  • getGeoCoordFromPixelCoord(coordinates)- Converts pixel coordinates to geo coordinates in the current selected map projection
  • getLatLongFromPixelCoord(coordinates) - Converts the geocoordinates to latitude and longitude coordinates. Input and output objects contains x and y properties.
  • getLayers() - Get an array of all added layers of this map
  • getMaxNumberOfAnimations() - Returns the maximum supported length of an animation
  • getNumLayers() - Returns the number of layers
  • getPixelCoordFromGeoCoord(coordinates) - Input coordinates with x and y properties (e.g. {x:5,y:52}), output pixel coordinates on the current drawn map.
  • getProjection()- Returns an element with srs and bbox properties
  • getSize() - Returns the current width and height of the map in width and height properties.
  • moveLayerDown(layer) - Moves the selected layer down
  • moveLayerUp(layer) - Moves the selected layer up
  • removeAllLayers() - Clear the map from all layers
  • removeListener(name) - Remove all listeners with the given name
  • setAnimationDelay(delayms) - Sets the time interval between animation steps in milliseconds
  • setBaseLayers(layers[]) - Provide an array of WMJSLayers
  • setBBOX(left,bottom,right,top) - Sets the boundingbox of the map in projection coordinates
  • setDimension(name,value) - Sets a dimensions value, for example: map.setDimension('time','2013-01-01T00:00:00Z');
  • setLayerOpacity(layer,opacity) - Sets the opacity for the given layer
  • setProjection(projection) - Provide an object containing a srs and bbox property, e.g. {srs:'EPSG:4326',bbox:'-180,-90,180,90'}. The bbox property can also be a WMJSBBox object
  • setSize(width,height) - Sets the size of the map
  • stopAnimating() - Stops the animation
  • toggleLayer(layer) - Hides/displays the selected layer
  • zoomIn(amount) - Zoomin with optionally a certain amount given, between 0.1 and 1. Default is 1.
  • zoomOut() - Zoom out
  • zoomTo(bbox) - Zooms to the area given by the bbox: {left:-180,bottom:-90,right:180,top:90}
  • zoomToLayer(layer) - Zoom to the given layer


  • ondimchange
  • onstopanimation
  • onstartanimation
  • onmapdimupdate
  • ondimchange
  • onimageload
  • onlegendready
  • onchangeactivelayer
  • onlayeradd
  • onsetprojection
  • onresize
  • onmapready
  • onloadingcomplete
  • beforedraw
  • ondrawready
  • onupdatebbox
  • onmapstartloading
  • onmaploadingcomplete
  • onloadingcomplete
  • ongetfeatureinfoready
  • beforegetpointinfo
  • ongetpointinfoready
  • beforegetfeatureinfo
  • mousedown
  • bboxchanged
  • onmousemove
  • mouseclicked
  • mouseup