how can I turn off all layer at WMS service (WMSLayer)? When I'am using ArcGIS dynamic service (ArcGISDynamicMapServiceLayer) method setVisibleLayers([-1]) turns off all layers. I seems to me, that this approach doesn't help at WMS service...
Thanks a lot!
Solved! Go to Solution.
I would think that the same would be true for the ArcGISDynamicMapServiceLayer. What you are doing is sending an array of layer IDs that you want visible and because that is not a layer id with -1 the ArcGISDynamicMapServiceLayer do not set any to visible. But the WMSLayer probably sees the -1 and it does not have that layer id and internally throws and error when searching for -1 and then bails because of the error. So sending an empty array would be the more accurate approach for both layer types.
sending empty array into setVisibleLayers for both ArcGISDynamicMapServiceLayer and WMSLayer would make sense, but unfortunatelly it doesn't work. To turn off all layer you have to send empty array for WMSLayer (as you said) and array with -1 -> [-1] for ArcGISDynamicMapServiceLayer. If I send empty array to ArcGISDynamicMapServiceLayer if show default visible layer as it's set in service ;)