Dynamically detecting map layer service type

3097
5
Jump to solution
01-19-2012 10:08 AM
AndyStewart1
New Contributor III
I'm looping through map layers.  How do I determine which services are dynamic vs. tiled vs. image?

The layer object in the Javascript API doesn't seem to have a TYPE property.  Am I wrong?
0 Kudos
1 Solution

Accepted Solutions
derekswingley1
Frequent Contributor
Use a layer's has a declaredClass property to figure out what kind of layer it is. For instance, declaredClass for a tiled layer is "esri.layers.ArcGISTiledMapServiceLayer".

View solution in original post

0 Kudos
5 Replies
derekswingley1
Frequent Contributor
Use a layer's has a declaredClass property to figure out what kind of layer it is. For instance, declaredClass for a tiled layer is "esri.layers.ArcGISTiledMapServiceLayer".
0 Kudos
AndyStewart1
New Contributor III
That was the ticket.  Thanks!
0 Kudos
derekswingley1
Frequent Contributor
My pleasure! Can you mark my previous post as the answer to the thread?
0 Kudos
ManishkumarPatel
Occasional Contributor II
Use a layer's has a declaredClass property to figure out what kind of layer it is. For instance, declaredClass for a tiled layer is "esri.layers.ArcGISTiledMapServiceLayer".


Hi Derek,

Could you please help provide some link to the documentation that states the information for declaredClass or if there are any more methods available. I tried to search through the API documentation but was not able to find anything related to layer.declaredClass

Although it works as a great solution to my issue I am just curious to know how does this work and what other methods or properties are available.

Thanks in advance!!!!

Best Regards,
Manish
0 Kudos
ManishkumarPatel
Occasional Contributor II
Hi Derek,

Could you please help provide some link to the documentation that states the information for declaredClass or if there are any more methods available. I tried to search through the API documentation but was not able to find anything related to layer.declaredClass

Although it works as a great solution to my issue I am just curious to know how does this work and what other methods or properties are available.

Thanks in advance!!!!

Best Regards,
Manish



Found the info.

http://livedocs.dojotoolkit.org/dijit/info#common-attributes-of-dijits



  • declaredClass - this is actually a relic of dojo.declare, which is how widgets are defined. The declaredClass is a string equal to the fully qualified name of the widget class.


require(["dijit/Dialog"], function(Dialog){     var myDialog = new Dialog({ title:"foo" }, "bar");     myDialog.declaredClass == "dijit/Dialog" // true });


Thanks,

Manish
0 Kudos