Going through the documents, I was trying to see if I could search through the ImageryLayerCollection via indexOf() to find an imagery layer that I added, though I’m not sure what to pass in as the ‘layer’ parameter since there’s no layer name or variable in my code. I’m adding the layer like this:
var imageryLayers = viewer.scene.imageryLayers;
imageryLayers.addImageryProvider(new Cesium.WebMapServiceImageryProvider({
url : ‘http://nowcoast.noaa.gov:80/wms/com.esri.wms.Esrimap/wwa’,
layers : ‘NHC_TRACK_POLY,NHC_TRACK_LIN,NHC_TRACK_PT,NHC_TRACK_WWLIN,NHC_TRACK_PT_72DATE,NHC_TRACK_PT_120DATE,NHC_TRACK_PT_0NAMEDATE,NHC_TRACK_PT_MSLPLABELS,NHC_TRACK_PT_72WLBL,NHC_TRACK_PT_120WLBL,NHC_TRACK_PT_72CAT,NHC_TRACK_PT_120CAT’,
parameters : {
transparent : true,
format : ‘image/png’
}
}));
``
Though it’s easy enough to use get() by passing in the index number for the desired imagery object…
var wms = viewer.scene.globe.imageryLayers.get(1);
wms.show = false;
``
I was thinking that I might be able to pass in an id, layername, or a class similar to OpenLayers (ie. map.getLayersByName() or map.getLayersByClass() where it will bring back the layer object) but I’m not sure if I’m not looking in the right places. As my application gets larger and more complex, I’ll be less confident that the wms layer will always be at index 1.
Am I thinking about this process backwards?
Thanks,
Zach