Layer list widget-Turning off layers at start

2543
7
Jump to solution
08-06-2013 09:39 AM
BradenPierson1
New Contributor
Hello all,

I have roughly 30 operational layers in my layer list widget, however, due to the large amount, I want either no layers or just a few to show up when the application starts. Is there a way for them to be toggled off at the start without manually having to go through each time to turn them off?

Thanks,

Braden Pierson
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
MattPohl
Occasional Contributor II
Braden-

There are two easy ways to do this. The first would be to turn the layers off in the mxd and restart each associated service and clear your REST cache. The second would be to use the 'visible' attribute within the <layer> tag and set it to false. This is done in your config.xml
<layer label="Your operational layer" type="dynamic" visible="false" alpha=".65" url="http://YourURL"/>


Be sure to clear your browser's cache to see the affect on the second option.

~Matt

View solution in original post

0 Kudos
7 Replies
MattPohl
Occasional Contributor II
Braden-

There are two easy ways to do this. The first would be to turn the layers off in the mxd and restart each associated service and clear your REST cache. The second would be to use the 'visible' attribute within the <layer> tag and set it to false. This is done in your config.xml
<layer label="Your operational layer" type="dynamic" visible="false" alpha=".65" url="http://YourURL"/>


Be sure to clear your browser's cache to see the affect on the second option.

~Matt
0 Kudos
BradenPierson1
New Contributor
Matt,

In regards to the first option, are you saying that I basically must re-include my operational layers after going through that process? Also, what are the ways to clear the REST cache through the application builder?

In regards to the second, after doing so, the layers were completely removed from the layer list so that I couldn't toggle them on if need be. I basically just need them to be unchecked from the beginning, but still there if I need them. Is there a way around this if the first option does not work for me?

Thanks for your help,

Braden
0 Kudos
MattPohl
Occasional Contributor II
Braden-

I was not aware that you were using the Application Builder, so lets just try the first option. Yes, you would still include those services as operational layers. So turn the layers off in ArcMap and restart the service. You don't clear your REST API Cache from the App Builder. If your on 10.1 than I don't think you need to clear the REST API Cache, but if your on 10.0 or lower than you would navigate to your REST endpoint. Example:
https://YourServerName/ArcGIS/rest/admin/  You than will login, choose 'Clear Cache Options' and than click the 'Clear Cache Now' link.

http://help.arcgis.com/en/arcgisserver/10.0/apis/rest/admin.html

Being that I never work with the App Builder I am just taking a stab at this. I can do some configuring on my end to test, or someone else may just jump in and explain the best practice.

~Matt
0 Kudos
BradenPierson1
New Contributor
Matt,

Through trying both options, I am still unable to work around this issue. The first one, even though my mxd. and msd. were both saved with layers unchecked, they still come up as checked once I added those operational layers. I will keep trying though!

Thanks,
Braden
0 Kudos
BradenPierson1
New Contributor
Actually, I got it to work through the configuration file. I had tried the same thing previously, however for some odd reason(probably due to a mistake on my end), it wasn't working.

Thanks for all the help!
Braden
0 Kudos
YasarKorkmaz
New Contributor III
Actually, I got it to work through the configuration file. I had tried the same thing previously, however for some odd reason(probably due to a mistake on my end), it wasn't working.

Thanks for all the help!
Braden


hi Braden,
Could you share your solution with me. I am trying to do the same thing as you (i.e have multiple layers but not have all of them turned on at start up -using flex viewer 3.4)
Thanks in advance,
Yas(h)ar
0 Kudos
AnthonyGiles
Frequent Contributor
Yasir,

You can turn the layers off by opening your config.xml file up in notepad and changing the visible attribute to false on the layers you do not want to be turned on by default:

<layer label="layer1" type="dynamic" visible="false" alpha="1" url="http://....."/>

Regards

Anthony

PS. If your file opens up in notepad as one long string, open in wordpad first, hit save then open up in notepad
0 Kudos