Javascript Map Layer Type

4591
4
Jump to solution
10-08-2014 11:22 AM
JimBridge
Occasional Contributor

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

0 Kudos
1 Solution

Accepted Solutions
KenBuja
MVP Esteemed Contributor

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.

request.png

View solution in original post

0 Kudos
4 Replies
KenBuja
MVP Esteemed Contributor

You can use declaredClass property of the layer. Take a look at this discussion.

0 Kudos
JimBridge
Occasional Contributor

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 :

Layer: Aerial (10)

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

0 Kudos
KenBuja
MVP Esteemed Contributor

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.

request.png

0 Kudos
JimBridge
Occasional Contributor

That will do exactly what I need.

Thanks for the help!

0 Kudos