Select to view content in your preferred language

How to get Layer Description

1036
4
03-15-2011 10:42 PM
LakshmananVenkatesan
Frequent Contributor
Hi

I have a dynamic map service with 60+ layers. For each layer I have added specific description. I want to get the description for each layer using Sliver light API. How to get the description.?
I can see the description text in my rest services.

Layer description is always null

API help says LayerLegendInfo has LayerDescription property which provides description of the layer. But  I do not know how to access layer Legend info class and get the layer description property

Pl help

SR
0 Kudos
4 Replies
JenniferNery
Esri Regular Contributor
You can include a LegendExtension from this thread: http://forums.arcgis.com/threads/18999-How-do-I-get-the-selected-LegendItem and access the selected LegendItemViewModel.

private void Button_Click(object sender, System.Windows.RoutedEventArgs e)
{
 var result = this.MyLegend.SelectedItems();
 foreach (var item in result)
  MessageBox.Show(item.Description);
}


Another way is to parse the json.
private void ArcGISDynamicMapServiceLayer_Initialized(object sender, System.EventArgs e)
{
 ArcGISDynamicMapServiceLayer layer = sender as ArcGISDynamicMapServiceLayer;
 foreach (var l in layer.Layers)
 {
  //TODO use this sub layer url 
  //string.Format("{0}/{1}/f=json", layer.Url, l.ID));
 }
}

http://forums.silverlight.net/forums/p/169016/385411.aspx
0 Kudos
OrenGal
Regular Contributor
Just needed to read Description from my 188 layers in the MXD. Used soap.

System.ServiceModel.EndpointAddress endPointAddress = new System.ServiceModel.EndpointAddress(pURL);
                System.ServiceModel.BasicHttpBinding basicHttpBinding = new System.ServiceModel.BasicHttpBinding() { MaxReceivedMessageSize = 2147483647 };
_client = new MapServerPortClient(basicHttpBinding, endPointAddress);
_client.GetServerInfoCompleted += new EventHandler<GetServerInfoCompletedEventArgs>(_client_GetServerInfoCompleted);
_client.GetServerInfoAsync("Layers");

private void _client_GetServerInfoCompleted(object sender, GetServerInfoCompletedEventArgs e)
{
    e.Result.MapLayerInfos....
}

Oren.
http://www.gal-systems.com
0 Kudos
JenniferNery
Esri Regular Contributor
Thank you for sharing your code. We have also included GetDetails() and GetAllDetails() in v2.3 to give you metadata information about a specific layer or all sub layers of ArcGISDynamicMapServiceLayer or ArcGISTiledMapServiceLayer.
0 Kudos
OrenGal
Regular Contributor
Thank you for sharing your code. We have also included GetDetails() and GetAllDetails() in v2.3 to give you metadata information about a specific layer or all sub layers of ArcGISDynamicMapServiceLayer or ArcGISTiledMapServiceLayer.


Great!
(What is v2.3? I'm using 3.0 beta1)
0 Kudos