1

Using the example below, from the CMV, what would be the best way to not show the Fire Stations layer in the Louisville Public Safety map service assuming I wanted to see everything else and I wanted sublayertoggle true?

            type: 'dynamic',
            url: 'http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/PublicSafety/PublicSafetyOperationalLayers/MapServer',
            title: 'Louisville Public Safety',
            slider: true,
            noLegend: false,
            collapsed: false,
            sublayerToggle: true, //true to automatically turn on sublayers
            options: {
                id: 'louisvillePubSafety',
                opacity: 1.0,
                visible: true,
                imageParameters: imageParameters
            },
            identifyLayerInfos: {
                layerIds: [2, 4, 5, 8, 12, 21]
            }

I've added these 3 lines after the declaring and setting of imageParameters:

var imageParameters2 = new ImageParameters(); imageParameters2.layerIds = [1]; imageParameters2.layerOption = ImageParameters.LAYER_OPTION_EXCLUDE;

and changed imageParameters: imageParameters to imageParameters: imageParameters2 in the layer config but the Fire Station layer still shows up.

  • CMV related questions are better answered in their own forum in GitHub – Farid Cheraghi Feb 18 '15 at 14:46
1

CMV does not support the exclusion of a dynamic service layer.
You have to make some changes.

  1. config\viewer.js
    add layerControlLayerInfos
    identifyLayerInfos: {
            layerIds: [2, 4, 5, 8, 12, 21]
    },
    layerControlLayerInfos: {
            visibilityLayerInfos: [0,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21]
    } //the layer with id 1 is not present
  2. gis\dijit\LayerControl\controls\Dynamic.js
    modify the _createSublayers function:
    enter image description here

  3. gis\dijit\LayerControl\plugins\legendUtil.js
    modify the _createDynamicSublayerLegendfunction:
    enter image description here

Now, the CMV support the exclusion of a dynamic service layer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.