I have a map with an unknown number of feature layers and raster layers. I need to be able to identify if a layer is a raster layer or a feature layer. I can't seem to find any where this is exposed. I tried looking in the map.getLayer("baseLayer").layerInfos collection but it doesn't have the type. In the Silverlight API I found this information when the legened was refreshed by checking the layerType field in the layeritems . I can't seem to find anything similar in the javascript api.
Thanks
Jim
Solved! Go to Solution.
Take a look at this sample that shows how to get information about a specific layer. While the sample only shows the fields, open up the browser's console to see all the information available (including type) about that layer.
You can use declaredClass property of the layer. Take a look at this discussion.
Ken ,
Thanks for the response. I'm not sure if I can get what I want from that, although it could just be me.
I can see that the map.getLayer("baseLayer") Is a dynamic layer using that but I want to see if the map layer listed in layerinfo is of type raster. I can't seem to get to that maybe I'm not hitting the sublayer. My base layer is a esri.layers.ArcGISDynamicMapServiceLayer tied to a rest service for a map that has multiple layers. If I look at the service directly and choose a layer I see :
Name: Aerial
Display Field:
Type: Raster Layer
Geometry Type: null
Description:
Definition Expression:
Copyright Text:
Default Visibility: true
MaxRecordCount: 0
Supported Query Formats: JSON, AMF
I may just be missing something but I can't seem to get something that tells me that this layer is raster?
Thanks
Jim
Take a look at this sample that shows how to get information about a specific layer. While the sample only shows the fields, open up the browser's console to see all the information available (including type) about that layer.
That will do exactly what I need.
Thanks for the help!