chagan02

Current visible layers

Discussion created by chagan02 on Jun 26, 2014
Latest reply on Jun 30, 2014 by chagan02
All,

Is there a built in method or function within the API that when executed will return an array of currently visible layers?

I have some functions written to refresh my map at certain time intervals, and also on command via a evt button.  I need to know which layers are currently visible before the refresh script runs so that I can turn them all back on.  You might be asking, why do they go off?  Well, they don't all go off, just certain csv layers.  I have 5 csv layers that are each created with a separate function.  Within the function, at the end is a .hide() command so that when the page is loaded the data is already created, but not visible.  Then the layer of choice is just turned on with another evt button.  However, if the user has one of these layers activated and the refresh function runs, which recreates the csv layers to populate new data (data is updated every five minutes), it will be invisible.  Thus, the need to know ahead of time which are visible so I can loop through them at the end of the refresh function to .show() them again. 

Thanks!

Outcomes