Select to view content in your preferred language

Dynamic Layer's visibleLayers property bug

2737
11
04-15-2011 07:47 AM
MichaelHaggerty
Emerging Contributor
Hello.

I'm having trouble displaying this map service in the out-of-the-box 2.2 Flex Viewer: http://secure.sterling-heights.net:32457/ArcGIS/rest/services/GIS_Maps/City_Utilities_Map/MapServer

The service consists of one layer group that contains two child layers.  Here is a clip of the map service's REST interface:

"layers": [
        {
            "id": 0,
            "name": "Street Lights",
            "parentLayerId": -1,
            "defaultVisibility": false,
            "subLayerIds": [
                1,
                2
            ]
        },
        {
            "id": 1,
            "name": "Street Lights OH Feed",
            "parentLayerId": 0,
            "defaultVisibility": true,
            "subLayerIds": null
        },
        {
            "id": 2,
            "name": "Street Lights UG Feed",
            "parentLayerId": 0,
            "defaultVisibility": true,
            "subLayerIds": null
        }
]


The behavior that I'm seeing in the default out-of-the-box Flex Viewer 2.2 is as follows:

  1. Click checkbox next to each child layer

  2. Click checkbox next to layer group

  3. Click checkbox next to dynamic layer name

  4. No features are displayed on map


However, if only one of the child layers is turned on, then you can see that layer's features.

Here's a couple screenshots of the problem:
http://www.screencast.com/users/MikeHaggerty/folders/Jing/media/e6cb6f8d-2036-4bf4-ad4c-74412ceef2aa
http://www.screencast.com/users/MikeHaggerty/folders/Jing/media/ecacdbe3-d733-497f-8b8c-07bbe21ecb26

When debugging the application, I can see the visibleLayers property of the target layer being set correctly to [1,2] on line 115 of com.esri.viewer.components.toc.tocClasses.TocMapLayerItem.refreshLayer() after the layer group is turned on and both child layers are on.  However, when inspecting the Export Map operation URL, I notice that there is no layers URL param: http://secure.sterling-heights.net:32457/ArcGIS/rest/services/GIS_Maps/City_Utilities_Map/MapServer/...

If I manually manipulate the Export Map operation URL to include "layers=show:1,2", then the image is rendered just fine: http://secure.sterling-heights.net:32457/ArcGIS/rest/services/GIS_Maps/City_Utilities_Map/MapServer/...

By the way, I've tested this map service on ArcGIS.com, and it works fine.  Here's a map w/ this layer setup already: http://www.arcgis.com/home/webmap/viewer.html?webmap=adbf558f561c4c21a537dc0b70537673

Thanks for any help you can offer!
Mike
Tags (2)
0 Kudos
11 Replies
RobertScheitlin__GISP
MVP Emeritus
Michael,

   Yes I manually added it just to test that there was not any issue with the actual service.
0 Kudos
MichaelHaggerty
Emerging Contributor
FYI -- the workaround we had the client implement was to set the defaultVisibility of the parent layer group to true in ArcMap.  This bug only presents when the layer group's defaultVisibility is set to false.

Thanks!
0 Kudos