setVisibility method for layer switcher

Hi
I was trying to use setVisibility method for switching my WMS geoserver layer inside viewer

this is the example:

$("#hot").prop(‘checked’, true);

function checkHot () {

if ($("#hot").prop(‘checked’)==true) {

hot.setVisibility(true);

} else {

hot.setVisibility(false);

}

};

$("#hot").change(function event(){checkHot()});

but it didn’t work

my firebug detected that setVisibility is not a function

plz help…

Best Regards…

Nakula…

Hi Nakula,
Please refer to the api documentation (cesiumjs.org/refdoc.html) or source code and search for ImageryLayer. The property you are looking for is “show”.

someImageryLayer.show = true;

Somewhat recently Cesium moved from setters/getters to javascript properties, e.g. show vs setShow(). Keep this in mind as you stumble upon older posts on the internet.

Alex

Ok I’ll try it out

Thanks so much

It’s working…

Thanks a lot sir… :smiley: