Programmatically Turning Layers Off/On

2005
4
11-09-2010 04:55 AM
RichHammond
New Contributor
We're currently trying to recreate functionality we have in our ArcIMS based mapping application within the ArcGIS Server Flex Viewer. One of the options we currently allow our visitors is to toggle on and off map themes, or predefined groupings of similar layers (i.e. a Recreation theme that will turn on the parks layer, boat ramp layer and trails layer). In ArcIMS we accomplished this through code on the back-end: theme names were passed as a query string in the URL, layers to be turned on and off for each theme were stored in tables within our RDBMS.

We're just getting our feet wet with the Flex Viewer and really are not sure where to begin to replicate this feature. We sorted through the standard widgets, but didn't come across anything that sounded like it would work. Does anyone have any suggestions or ideas that can get us going with this?

Thanks in advance,
Rich Hammond

GIS Team Leader
Florida Center for Community Design and Research
University of South Florida
Tags (2)
0 Kudos
4 Replies
RobertScheitlin__GISP
MVP Emeritus
Rich,

   I think what you are after can be handled with out any code modification. It would require you to have several configuration files and in the FlexViewers url you would just use the appropriate parameter.

i.e. http://gis.calhouncounty.org/IdentExample/index.html?config=config-eSearch.xml

Where ?config=config-eSearch.xml is the specific config file I want to load.

Now in the config file you can specify a visiblelayers attribute for each mapservice.

i.e
<layer label="Public Safety" type="dynamic" visible="true" visiblelayers="1,2"
       url="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Louisville/LOJIC_PublicSafety_Louisville/MapServer"/>
0 Kudos
NadeemShaukat
New Contributor II
Rich,

   I think what you are after can be handled with out any code modification. It would require you to have several configuration files and in the FlexViewers url you would just use the appropriate parameter.

i.e. http://gis.calhouncounty.org/IdentExample/index.html?config=config-eSearch.xml

Where ?config=config-eSearch.xml is the specific config file I want to load.

Now in the config file you can specify a visiblelayers attribute for each mapservice.

i.e
<layer label="Public Safety" type="dynamic" visible="true" visiblelayers="1,2"
       url="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Louisville/LOJIC_PublicSafety_Louisville/MapServer"/>


Robert,

In your application through the link above, I have noticed that you have an extra combo box for "Search Layer Field:" which is not available in the esearch widget. It seems very useful since it provides the flexibility to search against multiple fields. Could you provide the information about how you have implemented it and the new lines to be added in the xml file. Thanks

Nadeem
0 Kudos
NadeemShaukat
New Contributor II
Robert,

In your application through the link above, I have noticed that you have an extra combo box for "Search Layer Field:" which is not available in the esearch widget. It seems very useful since it provides the flexibility to search against multiple fields. Could you provide the information about how you have implemented it and the new lines to be added in the xml file. Thanks

Nadeem


Robert,

Never mind. I see that it has been implemented in your latest update.

Nadeem
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Nadeem,

   Yep you have to check if you have the latest release very often. Like I am working on the 2.2.5 version right now.
0 Kudos