Select to view content in your preferred language

Legend Widget not Refreshing

2298
20
Jump to solution
01-15-2013 12:31 PM
ronaldmcfarlane
Regular Contributor
I am running ArcGIS Server 10.1 SP1 and ArcGIS for Flexviewer 3.1.  I have a testbed Flex mapping application at maps.nwifc.org:8080/test_x.  The Legend Widget is described as showing only those service layers that are visible at the time of viewing.  Thus when a service is within its visible scale range the legend displays it and doesn't when it is beyond its visible scale range.  This behavior statement seems to be upheld when only the scale dependent service is turned on; when additional layers are also turned on the legend does not update unless the scale dependent service is cycled off/on for any given map scale.  The test map has three dynamic map services: County (polygon, visible at all scales), Offices (three points visible at all scales) and WRIA/WAU (two feature layers WRIA and WAU, with the WAU only visible once zoomed in beyond 300,000).  Turn off county and offices and the legend updates appropriately for WRIA/WAU as you zoom in or out.  Turn on either/both County and/or Offices and the legend does not update as you zoom in or out.  This problem exists regardless of public or private publication.  The behavior holds true across all my maps with scale dependent layers (over 10 map applications).  The map above is just a test map app to demonstrate the problem.  Any solutions or ideas out there?
Tags (2)
0 Kudos
1 Solution

Accepted Solutions
RobertScheitlin__GISP
MVP Emeritus
Ronald,

   Here it is. Let me know how it goes. May basic testing is working great.

View solution in original post

0 Kudos
20 Replies
SarthakDatt
Frequent Contributor
Hey Ronald,

I am not able to reproduce the issue when using out-of-the-box MapSwitcher widget and TOC component. Here's the excerpt from the config I used(works as expected):

<widget left="0" top="0"  config="widgets/HeaderController/HeaderControllerWidget.xml" url="widgets/HeaderController/HeaderControllerWidget.swf"/>

    <map wraparound180="true" addarcgisbasemaps="false" initialextent="-13906490 5826218 -13430340 6280858" fullextent="-13906490 5826218 -13430340 6280858"  top="40">
        <basemaps>
            <layer type="tiled" label="Streets" url="http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer" visible="true"/>
            <layer type="tiled" label="Topo" url="http://services.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer" visible="false"/>
            <layer type="tiled" label="Aerial" url="http://services.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer" visible="false"/>
        </basemaps>
        <operationallayers>
                  <layer type="dynamic" label="WRIA/WAU" url="http://hammerhead.nwifc.org:8080/ArcGIS/rest/services/Public/WriaWau/MapServer" visible="true"/>
                <layer type="dynamic" label="Office Location" url="http://hammerhead.nwifc.org:8080/ArcGIS/rest/services/Public/Office_Location/MapServer" visible="true"/>
                <layer type="dynamic" label="County" url="http://hammerhead.nwifc.org:8080/ArcGIS/rest/services/Public/County/MapServer" visible="true"/>
        </operationallayers>
    </map>

    <widgetcontainer layout="float">
         <widget label="Map Legend" x="80" y="100" preload="open" icon="assets/images/legend32.png" config="widgets/Legend /LegendWidget.xml" url="widgets/Legend/LegendWidget.swf"/>
    </widgetcontainer>
0 Kudos
ronaldmcfarlane
Regular Contributor
Ashamed to say I didn't check for widget compatibility issues (and I know better).  I was using the eMapSwitcher widget & TOCWidget with ESRI's Legend Widget.  Going back to ESRI's MapSwitcher widget with their Legend Widget resolved my problem.   Thank you for your assistance!
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Ronald,

   Do you mind setting up the test app back to the senario in question (i.e. eMapSwitcher, TOCWidget, OTB esri Legend widget)?
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Roland,

   Hmm... I have made some progress... If you remove the eMapSwitcher, MapSwitcher, TOCWidget and only have the OTB esri Legend widget it will not honor scale dependency either. There seem to be an issue that the esri MapSwitcher fixes for the legend widget.
0 Kudos
ronaldmcfarlane
Regular Contributor
Ronald,

   Do you mind setting up the test app back to the senario in question (i.e. eMapSwitcher, TOCWidget, OTB esri Legend widget)?


Turned map app back on.  I notice that if the layerlist visibility is set to true eMap, TOC and Legend all function (only Public of course).  If visibility is set to false, then the legend widget doesn't refresh.  Thus when I am using just eMap and Legend it works because visibility is true (making TOC seem the culprit).  Hope this helps.

A curiosity of mine, about half the time you address me as Ronald and the other half Roland - any reason?
0 Kudos
ronaldmcfarlane
Regular Contributor
Roland,

   Hmm... I have made some progress... If you remove the eMapSwitcher, MapSwitcher, TOCWidget and only have the OTB esri Legend widget it will not honor scale dependency either. There seem to be an issue that the esri MapSwitcher fixes for the legend widget.


Robert:
Here are some comparison map apps (the scale dependent layer flips at 300k):
maps.nwifc.org:8080/test_x   ( eMapSwitch, TOC, Legend (<layerlist visible="false">))
maps.nwifc.org:8080/test_x1   ( eMapSwitch, TOC, Legend (<layerlist visible="true">))
maps.nwifc.org:8080/test_y   ( MapSwitch, TOC, Legend (<layerlist visible="false">))
maps.nwifc.org:8080/test_y1   ( MapSwitch, TOC, Legend (<layerlist visible="true">))
maps.nwifc.org:8080/test_z   ( TOC, Legend )
maps.nwifc.org:8080/test_z1   ( Legend )

For public maps, x1 and y1 the legend works, for all the rest it does not.  Layerlist visibility seems to be the key in the map switchers and Legend seems to need one or the other map switcher (with layerlist visibility set to true) in order to function.  Without one or the other map switcher, Legend does not work with scale dependent layers.
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Ronald,

   Sorry about your name (just bad typing). I have found the solution that esri has in their MapSwitcherWidget that addresses the issue in the Legend and have applied it to my eMapSwitcherWidget and TOCWidget. I just need to test more and then release these fixes. The TOCWidget will be a longer wait as I am attempting to add support for secure services.
0 Kudos
ronaldmcfarlane
Regular Contributor
Ronald,

   Sorry about your name (just bad typing). I have found the solution that esri has in their MapSwitcherWidget that addresses the issue in the Legend and have applied it to my eMapSwitcherWidget and TOCWidget. I just need to test more and then release these fixes. The TOCWidget will be a longer wait as I am attempting to add support for secure services.


Robert:
Thank you for your help in this matter.  I am not entirely sure that ESRI's MapSwitcher Widget is the whole solution.  Layerlist visibility seems to be the key in the map switchers working with the Legend widget.  The Legend widget seems to need one or the other map switcher (with layerlist visibility set to true) in order to function. With either map switcher, if the layerlist is set to false, the Legend widget does not work with scale dependent layers.  The TOCWidget requires (per your TOC readme file) that the layerlist be set to false with either eMap or Mapswitcher widgets.

Unless you need them anymore, I will drop the map apps posted earlier.  Also I reconfigured the "test_z1" map to include ESRI's mapswitcher widget, with layerlist set to false to demo that the Legend widget doesn't work.

maps.nwifc.org:8080/test_z1 ( Legend Widget, MapSwitcher Widget, (<layerlist visible="false">))
0 Kudos
RobertScheitlin__GISP
MVP Emeritus
Ronald,

   I am done with the test apps, thanks for those. I am doing a rewrite of the TOCWidget right now but I do have this partucular issue fixed for the eMapSwitcherWidget and the TOCWidget.
0 Kudos