Select to view content in your preferred language

IdentifyTaks not working properlly

1175
2
08-18-2010 03:50 AM
JakubGutkowski
Emerging Contributor
When using IdentifyTask (IT) from SL codebehing, IT is working only for LayerOption.all enumeration.

I'm using ArcGISDynamicMapServiceLayer to display layers:

<esri:ArcGISDynamicMapServiceLayer ID="testLayer" 
     Url="http://wexgisag1/ArcGIS/rest/services/Envision/MapServer" 
     VisibleLayers="105"
     ImageFormat="PNG8" />


Layer is displayed and is working as it should. However when I try to identify feature on the layer by IdentifyTask:

IdentifyParameters identifyParameters = new IdentifyParameters();
// i've tried LayerOption.top and as well as adding Layers Ids as another filter
// w/o luck
identifyParameters.LayerOption = LayerOption.visible;
identifyParameters.ReturnGeometry = false;

identifyParameters.MapExtent = epaMap.Extent;
identifyParameters.Width = (int)epaMap.ActualWidth;
identifyParameters.Height = (int)epaMap.ActualHeight;

identifyParameters.Geometry = _savedLocation;


I'm not getting any results back.

If I will change parameters to:
identifyParameters.LayerOption = LayerOption.all;
// w/o adding filter on layers id operation is taking much to long but is working too
identifyParameters.LayerIds.Add(105); 


I'm getting results back.

I'm having same issue with querying on the REST xxx/Identify site. Therefore maybe this is related more to map service settings, if so, what can be set wrong there (if there is smth)?

I'm not GIS guy, I'm just doing demo to show what my company can use how this can be used. I did not install and configure ESRI/ArcGIS Servers maps etc. that was done by someone else (i don't even know who).

Any ideas why this is not working as it supposed to?
0 Kudos
2 Replies
DominiqueBroux
Esri Frequent Contributor
identifyParameters.LayerOption = LayerOption.visible;


LayerOption.visible means that the identify is based on the layers visible when the service has been published (not the layers visible during the last display).
This might explain your behavior if your layer "105" is not visible by default.


In this case, your code
 
identifyParameters.LayerOption = LayerOption.all;
identifyParameters.LayerIds.Add(105);

is the right one.
0 Kudos
JakubGutkowski
Emerging Contributor
Thanks Dominique, i thought it was because of this, however IMO you (ESRI) should update ArcGIS API Doc for LayerOption enum.

All visible layers at the specified location


It's not directly saying that Visible Layers defined on the Server not Visible Layers in Map control.
0 Kudos