AnsweredAssumed Answered

Possible bug : WMSLayer in 4.5 using resourceinfo and customLayerParameters

Question asked by bart.lissens@merkator on Oct 27, 2017

When adding WMSLayers using the resourceinfo instead of using a proxypage to get the capabilities of the layers,

the sublayers property is not used to populate the "layers" in the request to get the WMS images.

 

In version 4.4 of the api it was possible to use the "customlayerParamaters" to add the sublayers to the end of the request , but in version 4.5 this does not seem to work anymore.

This is also described in the API documentation : WMSLayer | API Reference | ArcGIS API for JavaScript 4.5 

 

A sample of the code i'm using at the moment can be found at the bottom of this post. 

The catalogItem.SubLayerCode is a string that contains comma separated values , where each value is a sublayername.

 

The request seems to be created correctly except for the "layers" property that is empty.

 

Getting the capabilities via a proxy is not an option as the server that is running the application does not have internet access.

 

does anyone know a workaround for this possible issue or is there something wrong with the way the sublayers are created?

 

thanks in advance.

 

var wmsSubLayers = [];

                    var sublayers = catalogItem.SubLayerCode.split(',');

                    sublayers.forEach(element => {

                        var subL = new WMSSubLayer({

                            id: element,

                            name: element,

                            spatialReferences: [31370],

                            visible: catalogItem.DefaultVisibility,

                            title: catalogItem.Name

                        });

                        wmsSubLayers.push(subL);

                    });

                    var layer = new WMSLayer({

                        //version: '1.3.0',

                        customLayerParameters: catalogItem.SubLayerCode,

                        visible: catalogItem.DefaultVisibility,

                        id: catalogItem.Name,

                        title: catalogItem.Name,

                        imageFormat: 'image/png',

                        url: catalogItem.Uri,

                        sublayers: wmsSubLayers,

                        resourceInfo: {

                            currentVersion: 10.31,

                            serviceDescription: '',

                            mapName: 'Asset infrastructuur Fluxys',

                            description: '',

                            copyrightText: '',

                            supportsDynamicLayers: false,

                            layers: catalogItem.SubLayerCode.split(','),

                            tables: [],

                            spatialReference: { 'wkid': 31370, 'latestWkid': 31370 },

                            singleFusedMapCache: false,

                            initialExtent: { 'xmin': 143818.85645561828, 'ymin': 217505.93448663258, 'xmax': 143845.3148418684, 'ymax': 217688.82808158646, 'spatialReference': { 'wkid': 31370, 'latestWkid': 31370 } },

                            fullExtent: { 'xmin': 0, 'ymin': 0, 'xmax': 300000, 'ymax': 250000, 'spatialReference': { 'wkid': 31370, 'latestWkid': 31370 } },

                            minScale: 0,

                            maxScale: 0,

                            units: 'esriMeters',

                            supportedImageFormatTypes: 'PNG32,PNG24,PNG,JPG,DIB,TIFF,EMF,PS,PDF,GIF,SVG,SVGZ,BMP',

                            documentInfo: { 'Title': '', 'Author': '', 'Comments': '', 'Subject': '', 'Category': '', 'AntialiasingMode': 'Fastest', 'TextAntialiasingMode': 'Force', 'Keywords': '' },

                            capabilities: 'Map,Query,Data', 'supportedQueryFormats': 'JSON, AMF',

                            exportTilesAllowed: false,

                            maxRecordCount: 1000,

                            maxImageHeight: 4096,

                            maxImageWidth: 4096,

                            supportedExtensions: ''

                        }

                    });

Outcomes