leaflet-layer-tree-plugin
leaflet-layer-tree-plugin copied to clipboard
Layer Definition outside of tree
Related to my other question regarding dynamically adding layers, I am wondering if this plugin requires that all layers be defined within the tree or if it is possible to create a layer var in the usual way and then construct the tree using the layer variables? Also does this plugin support non WFS layers?
Perhaps I am not understanding the parameters correctly and you could add documentation regarding these parameters:
{ code: "osm", name: "OpenStreetMap", active: true, selectedByDefault: false, openByDefault: true, childLayers: [], selectType: "MULTIPLE", serviceType: "OSM", params: { url: "http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png" } },
For example if you had a layer var:
var options_gc = {'transparent': true,'tiled': true,'format': 'image/png'};
var source_gc = L.WMS.source("http://geo.weather.gc.ca/geomet/?lang=en&service=WMS&request=GetCapabilities", options_gc);
var cadWeather = source_gc.getLayer('Canadian Weather');
How would you add that to the tree referencing cadWeather? Thanks.