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.visible, SpatialReference = MyMap.SpatialReference }; IdentifyTask identifyTask = new IdentifyTask("http://gismaps.pagnet.org/arcgis/rest/services/Interactive_TIP_2011/MapServer"); identifyTask.ExecuteCompleted += IdentifyTask_ExecuteCompleted; 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); }
AFAIK, the raster layers inside a map service are managed the same way than any feature layer.
How did you set the LayerOption and the LayerIds of your identify task? If LayerOption is set to visible, it means that the identify is taking care of the scale and so will not identify the raster layers that are not visible at the current scale.
Could this be your case?
If your service is public, can you share the identify request that is sent to the service (use fiddler to get it)?
Oh it is read-only in the sense that the instance cannot be changed but the collection can be modified. 🙂//identifyParameters.LayerIds = new System.Collections.Generic.List<int>(); <-- cannot change instance identifyParameters.LayerIds.AddRange(new int[] { 1, 2 }); // can change collection
You have a good weekend too.
Is your service public and could you share the map service URL, so we could test our side?
Hi Ramon,
I tested with your service and I am not able to reproduce the issue.
After setting the LayerOption to 'all' and the LayerIds to the range 1-13 (as you did), the identify task returns the infos about the 13 raster layers. See attached screenshot.
So for me, everything seems OK.
public List<int> checkVisibility() { List<int> visibleLayers = new List<int>(); if (MapLegend.LayerItems != null) { //look at feature layers in service layer [0] foreach (LayerItemViewModel enabledLyr in MapLegend.LayerItems[1].LayerItems) //Change this to [0], when MapLegend (xaml) specifies "LayerIDs="MainLayer"" -- [1] when not { //look and non-grouped feature layers if (enabledLyr.LayerItems == null) { //is it visible if (enabledLyr.IsVisible) { //exclude specific layers (before InitializeComponent) ==> List<int> ExcludeLayerList = new List<int> { 13, 14 }; if (!ExcludeLayerList.Contains(enabledLyr.SubLayerID)) { visibleLayers.Add(enabledLyr.SubLayerID); } } } //look and grouped feature layers if (enabledLyr.LayerItems != null) { //loop through feature layers under parent group for (int i = 0; i < enabledLyr.LayerItems.Count; i++) { //is it visible if (enabledLyr.LayerItems.IsVisible) { //exclude specific layers ==> List<int> ExcludeLayerList = new List<int> { 13, 14 }; if (!ExcludeLayerList.Contains(enabledLyr.LayerItems.SubLayerID)) { visibleLayers.Add(enabledLyr.LayerItems.SubLayerID); } } } } } } return visibleLayers; }