Select to view content in your preferred language

Identify problem

4489
35
04-25-2011 11:43 AM
DanielSchatt
Regular Contributor
I'm trying to use the identify functionality that is in the Identify sample. I have set

LayerOption = LayerOption.Visible

just as in the sample.  I assumed this means that all layers are accessible by the identify tool, but only layers that are checked as visible in the web application at any given time will be identified.  That's what I want.

But what's happening is that the identify function is only working on the layers that I set as visible in the original .mxd (and which therefore show initially as visible when I load the web site).  Those layers will always be identified in the web application whether they are visible or not, and other layers will never be identified whether they are visible or not.

Is this what's supposed to happen?  How can I get it to behave as I want? Thanks so much for any help...
0 Kudos
35 Replies
BarraLoubna
Deactivated User
j'ai fait ça:

            FeatureLayer dynamicServiceLayer = (FeatureLayer)MyMap.Layers["Limites_Administratives"];
            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://romulus/ArcGIS/rest/services/Limites_Administratives_Luxembourg/MapServer");
            identifyTask.ExecuteCompleted += IdentifyTask_ExecuteCompleted;
            identifyTask.Failed += IdentifyTask_Failed;
            identifyTask.ExecuteAsync(identifyParams);
  

            GraphicsLayer graphicsLayer = MyMap.Layers["Limites_Administratives"] as GraphicsLayer;
   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);


But there are no results, the table of Identify is empty.
Someone have another idea? please help me.
0 Kudos
JannalynPontello
Deactivated User
After the identify parameters, you need to add back this, too. This is what adds the layers to the identify task.

if (dynamicServiceLayer.VisibleLayers != null)
foreach (int x in dynamicServiceLayer.VisibleLayers)
identifyParams.LayerIds.Add(x);
if (dynamicServiceLayer.VisibleLayers.Length == 0) return;
0 Kudos
BarraLoubna
Deactivated User
I had already tested and does not work 😞

it gives me this error :
ESRI.ArcGIS.Client.FeatureLayer does not contain a definition for 'VisibleLayers' and no extension method 'VisibleLayers' accepting a first argument of type 'ESRI.ArcGIS.Client.FeatureLayer' could be found (are you missing a using directive or an assembly reference?)
0 Kudos
JannalynPontello
Deactivated User
I'm not sure, but I think the feature layer is causing the problem. Could you test by using an ArcGISDynamicMapServiceLayer in your xaml and then identifying using that layer?
0 Kudos
BarraLoubna
Deactivated User
I'm not sure, but I think the feature layer is causing the problem. Could you test by using an ArcGISDynamicMapServiceLayer in your xaml and then identifying using that layer?


It does not work also 😞

It no longer gives the error before, but the Identify table does not contains anything.
0 Kudos
BarraLoubna
Deactivated User
Hello,

Is does anyone has another idea?
Where is the ESRI teams? please help-me.
0 Kudos