-
Notifications
You must be signed in to change notification settings - Fork 43
AddLayer plugin
This plugin provides an easy way to publish new layers in MapStore programmatically. The AddLayer can be used both to add a new layerRecord (using teh 'addLayer' method) to the LayerTree and to directly add a WMS layer into the map (using the 'addToMap' method).
The complete plugin configuration is:
{
"ptype": "gxp_addlayer",
"showCapabilitiesGrid": true,
"useEvents": false,
"showReport": "never",
"directAddLayer": false,
"id": "addlayer",
"directAddLayerProps":{
"params":{
"styles": "",
"format": "image/png8",
"transparent": true
},
"options":{
"displayInLayerSwitcher": true,
"singleTile": false,
"ratio": 1,
"opacity": 1,
"buffer": 1
}
}
}
-
ptype
: the plugin name :gxp_addlayer
. -
showCapabilitiesGrid
: If setted to true, if the WMS source has been added correctly but any layer found using the gived name, this show the MapStore's capabilities grid in order to allow to the user to select one of the available layers from the source. -
useEvents
: If true fire the ready event after adding a layer (default false). -
showReport
: Default to 'never'. After adding a layer or a WMS source shows a simple grid that contains info about the newly added WMS layers on source. Possible values are: 'errors' (shows a repot dialog of imported resorces only if errors occurs), 'never' (never visualize the report), 'always' (always visualize the report). -
directAddLayer
: If true, use the WMS url and the layer's name in order to dyrectly add a WMS into the map (without loading capabilities and creating a new layerRecord). -
id
: the plugin instance Id. More AddLayer plugins can be enabled at the same time. -
directAddLayerProps
: Used for the 'directAddLayer' bheavior and allow the possibility to customize the OpenLayers's options and parameters to use for the WMS layer to add.
The method to use in order to add a new layer dynamically into the map is 'addLayer'. This method accepts some resources (in a JavaScript Array) that can be used in order to add a new layers (one or more) also in a GeoNetwork integrated context. Below a list of supported options:
-
msLayerTitle
: The title of the WMS layer to add. -
msLayerName
: The name of the WMS layer to add. -
wmsURL
: The URL of the WMS source. -
gnUrl
: The GeoNetwork base URL to use for metadata link in contextual menu. -
enableViewTab
: In a GeoNetwork integrated solution this allows to activate the WebGIS tab clicking the 'Interactive Map' button in order to see the added layer. -
msLayerUUID
: The GeoNetwork metadata UUID. -
gnLangStr
: The locale to use for GeopNetwork metadata's URL. -
customParams
: Allow to specify an additionsl Javascript Object for custom params/options/vendors to use for the WMS layer record, as an instance:{ cql_filter: **the-filter**, styles: **the-style**, displayInLayerSwitcher: **display-or-not**, }