Select to view content in your preferred language

identify single layer in map service

2347
2
12-10-2010 05:53 AM
JayKappy
Frequent Contributor
I am using the identify code example from the API examples.
I have this working...although I want to narrow this down and specifiy a single layer to idenitify on not all 3 of them...
I attached a word doc showing the service and directory structure...please reference the word doc, NOTE its two pages
This works for all three....
        Dim identifyTask5 As New IdentifyTask("http://gis.logis.org/arcgis/rest/services/MG_Test/MapServer")
        AddHandler identifyTask5.ExecuteCompleted, AddressOf IdentifyTask5_ExecuteCompleted
        AddHandler identifyTask5.Failed, AddressOf IdentifyTask5_Failed
        identifyTask5.ExecuteAsync(identifyParams2)

I then tried this:
Dim identifyTask5 As New IdentifyTask("http://gis.logis.org/arcgis/rest/services/" & "MG_Test/Parcel Base/MapServer")

and this
Dim identifyTask5 As New IdentifyTask("http://gis.logis.org/arcgis/rest/services/MG_Test/Parcel Base/MapServer")


Any thoughts on the sysntax to get it to just identify on the Parcel Base Layer in the map service?

Thanks
0 Kudos
2 Replies
JenniferNery
Esri Regular Contributor
The IdentifyParameters include LayerIds Property. http://help.arcgis.com/en/webapi/silverlight/apiref/ESRI.ArcGIS.Client~ESRI.ArcGIS.Client.Tasks.Iden...

I'm not entirely sure about the C# to VB conversion but hopefully you get the idea:
Dim identifyParams As New IdentifyParameters() With { _
 Key .Geometry = clickPoint, _
 Key .MapExtent = MyMap.Extent, _
 Key .Width = CInt(MyMap.ActualWidth), _
 Key .Height = CInt(MyMap.ActualHeight), _
 Key .LayerOption = LayerOption.visible _
}
identifyParams.LayerIds.Add(3)

Where 3 is the layer ID of interest.

Here's the SDK sample: http://help.arcgis.com/en/webapi/silverlight/samples/start.htm#Identify. Just add the code in red to test it out.
0 Kudos
JayKappy
Frequent Contributor
THANKS...that worked great....


        
Dim identifyParamsParcelsPrecinct As ESRI.ArcGIS.Client.Tasks.IdentifyParameters = New IdentifyParameters() With {.Geometry = clickPoint, .MapExtent = MyMap.Extent, .SpatialReference = MyMap.SpatialReference, .Width = CInt(Fix(MyMap.ActualWidth)), .Height = CInt(Fix(MyMap.ActualHeight)), .LayerOption = LayerOption.visible}
 ' Set the layer to identify on
identifyParamsParcelsPrecinct.LayerIds.Add(2)        
Dim identifyTask3 As New IdentifyTask("http://services.arcgisonline.com/ArcGIS/rest/services/" & "Demographics/USA_Median_Age/MapServer")
AddHandler identifyTask2.ExecuteCompleted, AddressOf IdentifyTask2_ExecuteCompleted
AddHandler identifyTask2.Failed, AddressOf IdentifyTask2_Failed
identifyTask2.ExecuteAsync(identifyParamsParcelsPrecinct)
0 Kudos