diff --git a/src/viewer.js b/src/viewer.js index e8442369f..0ba04e1ac 100644 --- a/src/viewer.js +++ b/src/viewer.js @@ -43,6 +43,7 @@ const Viewer = function Viewer(targetOption, options = {}) { zoom: zoomOption = 0, resolutions = null, layers: layerOptions = [], + layerParams = {}, map: mapName, params: urlParams = {}, proj4Defs, @@ -407,7 +408,11 @@ const Viewer = function Viewer(targetOption, options = {}) { } }; - const addLayer = function addLayer(layerProps, insertBefore) { + const addLayer = function addLayer(thisProps, insertBefore) { + let layerProps = thisProps; + if (thisProps.layerParam && layerParams[thisProps.layerParam]) { + layerProps = Object.assign({}, layerParams[thisProps.layerParam], thisProps); + } const layer = Layer(layerProps, this); addLayerStylePicker(layerProps); if (insertBefore) {