Getting sub layers from ArcGISDynamicMapservice

865
1
10-18-2016 05:09 AM
Abdul_Raheem
New Contributor

I have a rest service url which I have used to create dynamic service and added it to the map. I want to loop through the arcgis dynamic map service layer to access feature layers in it.Is there any way to access feature layers in arcgis dynamic layer ?

0 Kudos
1 Reply
Abdul_Raheem
New Contributor

I think I have found a solution to my problem. I am using the following to get details of a feature layer from ArcGISDynamicServiceMapLayer and applying the required query definition to it.

ArcGISDynamicMapServiceLayer dynamicLayer=myMap.Layers["myDynamicLayer"] as ArcGISDynamicMapServiceLayer;

string query="";

dynamicLayer.GetDetails(layerID,(ESRI.ArcGIS.Client.FeatuerService.FeatureLayerInfo myFeatureLayer,Exception ex) => {

         if(ex == null)

         {

             query=myFeatureLayer.DefinitionExpression;

             System.Collections.ObjectModel.ObservableCollection<LayerDefination> definitionCollection = new      System.Collections.ObjectModel.ObservableCollection<LayerDefination>();

        LayerDefinition layerDef=new LayerDefinition();

        layerDef.ID=layerID;

       layerDef.Definition=query+" AND Count > 100";

       definitionCollection.Add(layerDef);

       dynamicLayer.LayerDefinitions=definitionCollection;

       dynamicLayer.Refresh();

         }

}

Source: silverlight api reference

0 Kudos