Sunday, 2 December 2018

arcgis javascript api - Configurable Map Viewer (CMV) - Configure dynamic layer to not display all sub-layers?


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.




No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...