Select to view content in your preferred language

GroupLayer issue

4502
4
Jump to solution
02-19-2013 12:47 AM
JohanCarlsson
Regular Contributor
I am currently working with the ArcGIS Online Portal. I load a map document from our portal, iterate through the layers and add them to a group layer. However, when added to the map, I can select several child layers of the group layer, but I can't deselect them. Adding each layer individually without using group layer works fine, they then behave as any other layer in the map content list. I add many different types of layers to one group layer (tiled layers, feature layers and so on). I've tried to group layers by type but it still behaves the same way. Each layer has a unique ID. The provided image displays the behavior.

How can I achieve the same behavior as a map service (no child layers are selectable)?

            GroupLayer groupLayer = new GroupLayer();             groupLayer.ID = Guid.NewGuid().ToString();             groupLayer.DisplayName = portalItem.Title;              foreach (Layer layer in selectedMap.Layers)             {                 if (Document.GetIsBaseMap(layer) && (selectedMap.Layers.Count > 1))                     continue;                  layer.ID = layer.ID ?? Guid.NewGuid().ToString();                 layer.InitializationFailed += Layer_InitializationFailed;                  if (string.IsNullOrEmpty(layer.DisplayName))                     MapApplication.SetLayerName(layer, layer.ID);                  groupLayer.ChildLayers.Add(layer)            }              selectedMap.Layers.Clear();             MapApplication.Current.Map.Layers.Add(groupLayer);             foreach (Layer layer in groupLayer.ChildLayers)                 MapApplication.SetLayerName(layer, layer.DisplayName);             MapApplication.SetLayerName(groupLayer, portalItem.Title + " [Portal]");             selectedMap = null;
0 Kudos
1 Solution

Accepted Solutions
KatherineDalton
Esri Regular Contributor
Hi Johan,

The short answer is that group layers are not supported in the Builder/Viewer. We have this logged as an enhancement request for a future release.

Hope that helps,
Katy
Katy Dalton | Technical Consultant
THE SCIENCE OF WHERE™

View solution in original post

0 Kudos
4 Replies
JohanCarlsson
Regular Contributor
I'd like to ask an additional question while the topic is up:
How does the FullExtent member of the GroupLayer work? I never get any other value than null for it, and I'd like to be able to use GoTo command for the top level of the grouped layer. Overriding doesn't work, what is the simplest way?

EDIT: Just realized this is probably an API-related question but perhaps someone has an answer.
0 Kudos
KatherineDalton
Esri Regular Contributor
Hi Johan,

The short answer is that group layers are not supported in the Builder/Viewer. We have this logged as an enhancement request for a future release.

Hope that helps,
Katy
Katy Dalton | Technical Consultant
THE SCIENCE OF WHERE™
0 Kudos
JohanCarlsson
Regular Contributor
That was all I needed to know, thank you Katy! I will keep an eye open for this in future releases.
0 Kudos
AaronFischer
Emerging Contributor
Any idea when support for grouping layers will be released?
We are looking at extending the MapContents control to support this and the task seems rather large,
and we would like to know if it is worth the investment.
If this is going to be included in a release within the next few months then it makes sense for us to just wait.

Thanks!
0 Kudos