bill@poconogis.com

How to set visibility of a layer by code

Discussion created by bill@poconogis.com on Jun 18, 2014
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?

Outcomes