How can I group layers together in ArcGIS Viewer for Flex?

5977
12
Jump to solution
04-01-2015 11:52 AM
JacobGuthrie
New Contributor

I have a web app in progress with numerous layers brought in through my ArcGIS Online account. I want to be able to group certain ones together to make the Layer List more organized, and so I can turn off/on layer groups instead of going through it one by one. Does anyone have a solution?

Thanks,

Jacob

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
HaskettGeorge
New Contributor III

I don't remember how to post code in a nice manner so I'll just copy and post an example:

  <widgetcontainer layout="float">

    <widgetgroup label="Misc Tools" icon="assets/images/i_options.png">

      <widget label="Draw &amp; Measure" url="widgets/eDraw/eDrawWidget.swf" config="widgets/eDraw/eDrawWidget.xml" icon="assets/images/i_measure.png" top="150" right="20" />

      <widget label="Bookmarks" url="widgets/Bookmark/BookmarkWidget.swf" config="widgets/Bookmark/BookmarkWidget.xml" icon="assets/images/i_bookmark.png" top="200" right="20" />

      <widget label="Print" url="widgets/Print/PrintWidget.swf" config="widgets/Print/PrintWidget.xml" icon="assets/images/i_print.png" top="250" right="20" />

    </widgetgroup>\

If you are using something like XML Notepad it would look like this:

widgetGroup.JPG

An ESRI example with widgetgroup

ArcGIS Viewer for Flex

Granted I don't use the App Builder when working with the Viewer for Flex, its too limiting.  I edit the tag references via XML Notepad.

View solution in original post

0 Kudos
12 Replies
RobertScheitlin__GISP
MVP Emeritus

Jacob,

   You can only accomplish this ArcMap by grouping those layers and republishing the map service.

0 Kudos
JacobGuthrie
New Contributor

I had tried that originally and I was getting error messages when I verified the service before publishing.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Jacob,

   Not sure why you would be getting an error. I do this all the time.

0 Kudos
HaskettGeorge
New Contributor III

Like Robert mentioned, if you can group them and republish your services, that would be the best bet.

However, if you cannot for whatever reason, you could create multiple layer lists using the default layer list widget that would allow you to group the individual services together as necessary.  For example, you would have (1) layer list for geographic data, another for demographic data, etc.  You could have them side by side in your main widget container or stack them in a new widget group.  I've done both to clean things up a bit.

Its not the ideal way to go about it, but if you are forced to use an excessive amount of layers then it will allow you to control them to some point.

JacobGuthrie
New Contributor

I took a few layers out of the original .mxd and group some together in a new .mxd and published that as a service with published fine but the layers are grouped when I bring them into Viewer for Flex.

George, you mentioned stacking widgets in a new widget group. I wasn't aware you were able to do that in viewer for flex. How did you accomplish this?

0 Kudos
HaskettGeorge
New Contributor III

I don't remember how to post code in a nice manner so I'll just copy and post an example:

  <widgetcontainer layout="float">

    <widgetgroup label="Misc Tools" icon="assets/images/i_options.png">

      <widget label="Draw &amp; Measure" url="widgets/eDraw/eDrawWidget.swf" config="widgets/eDraw/eDrawWidget.xml" icon="assets/images/i_measure.png" top="150" right="20" />

      <widget label="Bookmarks" url="widgets/Bookmark/BookmarkWidget.swf" config="widgets/Bookmark/BookmarkWidget.xml" icon="assets/images/i_bookmark.png" top="200" right="20" />

      <widget label="Print" url="widgets/Print/PrintWidget.swf" config="widgets/Print/PrintWidget.xml" icon="assets/images/i_print.png" top="250" right="20" />

    </widgetgroup>\

If you are using something like XML Notepad it would look like this:

widgetGroup.JPG

An ESRI example with widgetgroup

ArcGIS Viewer for Flex

Granted I don't use the App Builder when working with the Viewer for Flex, its too limiting.  I edit the tag references via XML Notepad.

0 Kudos
KirstenLawrence
New Contributor III

Do you have a sample app you could send a link to so I could see how this works?

0 Kudos
OlegLukyanov
New Contributor III

Hi,

I use TOCGroupWidget from How we can make a group of layers?

0 Kudos
KirstenLawrence
New Contributor III

Thanks for the reply. Which version of flex viewer are you using? I am using 3.7 will it work with that version?

0 Kudos