WMS Layer in TOC

618
5
05-07-2019 03:00 AM
AlbertoSantos_Cendrero
New Contributor

Nianwei Liu‌. Good morning:

Does your TOC support WMS Layer? How could I make the legend of its layers in a WMS Layer?

Thank you very much and forgive for the inconvenience.

0 Kudos
5 Replies
deleted-user--MMnVrog9xw_
Occasional Contributor

When you add the WMS layer you point to the URL for the legend image:

// Typical usage
var layer = new WMSLayer({
  url: // url to the service,
  sublayers: [{
    name: // name of the sublayer,
    legendUrl: // url to the legend
  }]
});

https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-WMSLayer.html

0 Kudos
AlbertoSantos_Cendrero
New Contributor

Thank you very much for your answer.

And forgive for the inconvenience, but when I asked the question do not specify that it is for version 3.x

0 Kudos
Noah-Sager
Esri Regular Contributor

Here is an example of using a WMS layer with a Legend and a LayerList widget.

https://codepen.io/noash/pen/eaNLjK

0 Kudos
AlbertoSantos_Cendrero
New Contributor
158/5000
Thank you very much for your response but I'm not worth that option you indicate.

In the application that I am working, I use the TOC.js developed by Nianwei Liu.
0 Kudos
AlbertoSantos_Cendrero
New Contributor

Specifically, I use the dijit / TOC of this example:

http://www.arcgis.com/home/item.html?id=9b6280a6bfb0430f8d1ebc969276b109 

0 Kudos