Determine queryable/selectable layers

1339
3
09-08-2011 09:15 PM
De_WetEllis
New Contributor III
Hi

I am having problems with my viewer I created. The Viewer allows a user to select a layer from a dropdown and from that layer use the Query tools to query that specific layer. To populate the Dropdown I just looped through all visibles layers. But the problem is that the Service/MXD contains another service ( Almost like a BASEMAP ) . But that layer is an Image Service. And also Unselectable.
The problem is that the client designed this MXD and I cant change anything.

Now the query task fails on that layers.

How can I determine all the layers that are queryable/selectable. I cannot find a property on LayerInfo. Only if its visible. The viewer is not specific to a Service. Its a plug in viewer and should work on any Service I specify.

Any Solutions or Suggestions on how to get this list of layers. I am using an ArcGISDynamicMapServiceLayer.

Specs:  ARCGIS 10 , API 2.2 , Silverlight 4 , C#

Thanks

De Wet
0 Kudos
3 Replies
De_WetEllis
New Contributor III
Hi

Okay , I was thinking about this issue. And maybe there is a different Solution. But I still need help on doing this.

The Background layer doesnt have a featureclass. So how can I determine if the Layer has a feature class. Then if the Feature Class is Null then I know its a background layer. ( Something like that ).

The Layerinfo for each layer within a ArcGISDynamicMapServiceLayer doesnt show me anything regarding the Capabilities of the Layer.

Any suggestions Please.

Thanks.

De Wet
0 Kudos
DominiqueBroux
Esri Frequent Contributor
One way is you to query the layers resource of the map service and deserialize the response by yourself:
   - documentation : http://help.arcgis.com/en/arcgisserver/10.0/apis/rest/layers.html
   - sample : http://services.arcgisonline.com/ArcGIS/rest/services/Demographics/USA_Percent_Over_64/MapServer/lay...

The type field is giving you the type of layer (Feature Layer, Raster, Group Layer, ....)
0 Kudos
De_WetEllis
New Contributor III
Hi Dominique

Thanks for the Reply. This could be very usefull.

While debugging this morning I found this.

On my Legend_Refreshed the LayerItems is of Type LayerItemViewModel.

Foreach LayerItemViewModel it has a Property "LayerType" that specifies what layer it is.
Like LayerType = "Feature Layer" or LayerType = "Group Layer".

I am using a Legend so in this case this will work but in a case where you are not using a legend and need Layer Information the solution you provided will work.

Thanks A Lot.

De Wet
0 Kudos