WMS use

WMS support is part of the minimum, standard and extended APIs.

Foreword

Read the WMS-C foreword again !

2D Web Javascript API

Configuration

Adding a WMS layer is as simple as that :

myMap.getMap().addLayer(
    "WMS",
    layer_name,
    "url_to_wms",
    wms_parameters,
    layer_options
);
  • the layer_name parameter holds the text that will be displayed by the layers switcher. This name may be a string or an (See multi-lingual) ;
  • the url_to_wms parameter holds the WMS URL ;
  • the wms_parameters holds all parameters needed to define the WMS like layers, format, transparent, etc ...
  • the layer_options holds parameters for managing the WMS behavior like singleTile, projection, units, maxExtent, minZoomLevel, maxZoomLevel, opacity, isBaseLayer, visibility, originators, etc ... It is worth noting that maxExtent should be expressed in the chosen projection spatial reference system.

    All in all, there is no significant difference between OpenLayers.Layer.WMS use and Geoportal.Layer.WMS use expect for the geographic rights management that is :

  • either added automagically by the standard and extended API ;
  • or added manually (by the developper) as follow (See operating for more information) :
    • add a GeoRM option in the layer_options ;
    • assign the following code to the GeoRM option :
GeoRM: Geoportal.GeoRMHandler.addKey(
    gGEOPORTALRIGHTSMANAGEMENT.apiKey,
    gGEOPORTALRIGHTSMANAGEMENT[gGEOPORTALRIGHTSMANAGEMENT.apiKey].tokenServer.url,
    gGEOPORTALRIGHTSMANAGEMENT[gGEOPORTALRIGHTSMANAGEMENT.apiKey].tokenServer.ttl,
    myMap)