Select to view content in your preferred language

Dynamic Map Services and Identify

804
2
03-02-2011 10:03 AM
JamesStreet1
Emerging Contributor
I have a dynamic map service that has a group layer with sub layers underneath it. The mxd has the group layer turned off by default and the sub layers are switched on. I then have a treeview that controls switching on and off these layers via the group layer etc

When I try to use the identify class within the Silverlight API I populate my IdentifyParameters object with the list of layers (ie the sublayers) but nothing gets returned for the location I am trying to identify even though visibility seems to be OK and the features are displayed on the map.

If I set the mxd with the group layer turned on a pass in the exact same layer id's to the IdentifyParameters object it works fine.

I would think the layerIds property on IdentifyParameters would operate independently from any visibility on the map so even if something is not being set correctly on the Dynamic layer itself it should still work.

Anyone experience a similar problem?
0 Kudos
2 Replies
AngelGonzalez
Frequent Contributor
See the link below. Basically since your group layer is off on the map service the identify will not pull any results from your sublayers. You need to specify the layers ID within the IdentfiyParameters when you turn them on and off in your treeview or set the parameter LayerOption = LayerOption.all within your IdentifyParameters

http://forums.arcgis.com/threads/3436-layers-missing-from-identify-results

private void QueryPoint_MouseClick(object sender, ESRI.ArcGIS.Client.Map.MouseEventArgs e)
      {
         ESRI.ArcGIS.Client.Geometry.MapPoint clickPoint = e.MapPoint;

         ESRI.ArcGIS.Client.Tasks.IdentifyParameters identifyParams = new IdentifyParameters()
         {
            Geometry = clickPoint,
            MapExtent = MyMap.Extent,
            Width = (int)MyMap.ActualWidth,
            Height = (int)MyMap.ActualHeight,
            LayerOption = LayerOption.all,
            SpatialReference = MyMap.SpatialReference
         };

         IdentifyTask identifyTask = new IdentifyTask("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/" +
             "Demographics/ESRI_Census_USA/MapServer");
         identifyTask.ExecuteCompleted += IdentifyTask_ExecuteCompleted;
         identifyTask.Failed += IdentifyTask_Failed;
         identifyTask.ExecuteAsync(identifyParams);

         GraphicsLayer graphicsLayer = MyMap.Layers["MyGraphicsLayer"] as GraphicsLayer;
         graphicsLayer.ClearGraphics();
         ESRI.ArcGIS.Client.Graphic graphic = new ESRI.ArcGIS.Client.Graphic()
         {
            Geometry = clickPoint,
            Symbol = LayoutRoot.Resources["DefaultPictureSymbol"] as ESRI.ArcGIS.Client.Symbols.Symbol
         };
         graphicsLayer.Graphics.Add(graphic);
      }
0 Kudos
JenniferNery
Esri Regular Contributor
What version of the ArcGIS Server are you using?

If you are using v10 or lower, you might be hitting this bug that is now fixed with ArcGIS Server 10 SP1.
http://downloads2.esri.com/support/downloads/other_/ArcGIS-10sp1-issues.htm#dotnet1-sp1
NIM058088 - MapService Identify with top|visible layers option does not return any results for a layer with visibility turned off in the map.
0 Kudos