How to set visibility of a layer by code

679
0
06-18-2014 07:15 AM
BillChappell
Occasional Contributor II
I've been tasked to create a method to store current checkbox values. I'm using loaclStorage and I can retrieve:

the LayerID, the info.id, and if the layer/sublayer was checked visible. As I'm reading each item from localStorage, I'd like to set the visibility for the layer.

for example I've stored the layer "Basemap", and the SubLayer is Roads (Index# 2) and the visible value was False.

Is there a code like:

map.getLayer(Basemap).layerInfos(2).setVisibility(false);

That would work?
0 Kudos
0 Replies