WMS Layer Legend Graphic from GeoServer

343
0
04-21-2020 12:40 PM
SRIVENKATESHVASIRAJU1
New Contributor II

Hi All,

I am new to the ESRI js API 4.15. I have understood the way the WMSLayers work on the API. The issue I am having is with the Legend for the WMSLayer. The legendUrl  under the WMSLayers/sublayers is a GeoServer end point with some custom Parameters. The WMS Layer gets added to the map just fine.... But the Legend does not appear as the URL get tacked together for both the getMap and GetLegendGraphic. So the Image does not appear. Can anyone help me with this? 

Here is snapshot of what is happening.

Here is my code : 

wmsLayer = new WMSLayer({
    id: tax_id,
    url: "Some Geoserver WMS Service",
    visible: true,
    customLayerParameters: {
        SERVICE: "WMS",
        FORMAT: "image/png",
        TRANSPARENT: "TRUE",
        CRS: "EPSG:102100",
        STYLES: '',
        REQUEST: "GetMap",
        LAYERS: layerText,
        cql_filter: filterText,
        WIDTH: width,
        HEIGHT: height,
        BBOX: bBox,
        crs: "EPSG:3857",
        spatialReferences: [3875, 3875, 3875]
    },
    version: "1.3.0",
    imageFormat: "png",
    opacity: 0.75,
    sublayers: [{
        name: "Species Observations",
        legendUrl: "GeoServer URL where the Legend Graphic is available"
    }],
})
map.add(wmsLayer);
0 Kudos
0 Replies