cmv / cmv-app

CMV - The Configurable Map Viewer - A community supported open source mapping framework built with the Esri JavaScript API and the Dojo Toolkit
https://demo.cmv.io/
MIT License
325 stars 278 forks source link

How to setLayerDefinitions for dynamic layer type on App load ? #896

Closed mayur9785 closed 5 years ago

mayur9785 commented 5 years ago

Hi,

How to apply setLayerDefinitions for Dynamic layer on App load ?

Below is my dynamic layer in OperationalLayer :

{
            type: 'dynamic',
            url: 'http://myservice/arcgis/rest/services/BPDHC/GIS_Map_2019/MapServer',

            title: i18n.viewer.operationalLayers.dashboard,
            options: {
                id: 'dashboard',
                opacity: 1.0,
                visible: true,
                imageParameters: buildImageParameters({
                    layerIds: [0],
                    layerOption: 'show'
                }),
            },
            identifyLayerInfos: {
                returnFieldName: true
            },
            legendLayerInfos: {
                exclude: false
            },
            layerControlLayerInfos: {
                swipe: true,
                metadataUrl: true,
                expanded: true,
            }
        },

Thanks,

green3g commented 5 years ago

@mayur9785 This question has been asked before - IIRC you can do something like the solution mentioned in this answer:

https://github.com/cmv/cmv-app/issues/357#issuecomment-242726660