I have multiple map layers (right now about a dozen but that will likely stretch to several dozen) in my CMV. I have introduced several WMS services to operationalLayers that I have published to a local server. Only the "Parcels" service will show up. I have tried different combinations of several layers but I can never get more than one layer to display at a time. Does anybody know why multiple services will not display in my CMV?

This is what the section in my viewer.js looks like:

operationalLayers: [{
        type: 'dynamic',
        url: 'http://arcgis.mydomain.com/arcgis/rest/services/Floodplain/Floodplain/MapServer',
        title: '100yr Floodplain',
        options: {
            id: 'Floodplain',
            opacity: 1.0,
            visible: true,
            outFields: ['*']
        },
        identifyLayerInfos: {
            layerIds: [0,1,2,3,4]
        },
        legendLayerInfos: {
            layerInfo: {
                hideLayers: [21]
            }
        },
        type: 'dynamic',
        url: 'http://arcgis.mydomain.com/arcgis/rest/services/Parcels/Parcels/MapServer',
        title: 'NY Parcels',
        options: {
            id: 'Parcels',
            opacity: 1.0,
            visible: true,
            outFields: ['*']
        },
        identifyLayerInfos: {
            layerIds: [0,1,2,3,4]
        },
        legendLayerInfos: {
            layerInfo: {
                hideLayers: [21]
            }
        }
}],
up vote 1 down vote accepted

From the JSON you posted, it looks you have the configuration for 2 layers in a single operational layer. Since there are duplicate properties such title for the single layer, it uses the second one, Parcels in this case.

The operational layers is an array that should look like this:

operationalLayers: [ { type: 'feature', /* details of layer 1 */ }, { type: 'dynamic', /* details of layer 2 */ }, { type: 'dynamic', /* details of layer 3 */ } /* keep adding layers... */ ]

In your code, you are missing the ending }, for layer 1 and the beginning { for layer 2. It should look like this:

operationalLayers: [ { type: 'dynamic', url: 'http://arcgis.mydomain.com/arcgis/rest/services/Floodplain/Floodplain/MapServer', title: '100yr Floodplain', options: { id: 'Floodplain', opacity: 1.0, visible: true, outFields: ['*'] }, identifyLayerInfos: { layerIds: [0,1,2,3,4] }, legendLayerInfos: { layerInfo: { hideLayers: [21] } }, }, { type: 'dynamic', url: 'http://arcgis.mydomain.com/arcgis/rest/services/Parcels/Parcels/MapServer', title: 'NY Parcels', options: { id: 'Parcels', opacity: 1.0, visible: true, outFields: ['*'] }, identifyLayerInfos: { layerIds: [0,1,2,3,4] }, legendLayerInfos: { layerInfo: { hideLayers: [21] } } } ],

  • Embarrassed that I missed that. Thanks. – jredd Jan 29 '16 at 21:36
  • no need for that. A second set of eyes is sometimes needed. – tmcgee Jan 29 '16 at 21:37

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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