Is there a way to get the geometry type of the individual layers, other than below, in an ArcGISDynamicMapServiceLayer? I am using The javascript api 3.6 and server 10.1. [INDENT]var handle = esri.request({ url: layer.url + "/" + id + "?f=pjson", callbackParamName: 'callback', handleAs: 'json', load: dojo.hitch(this, gotTheInfo) });[/INDENT]
Unfortunately, lots of layer properties won't be available until the layer is loaded. There will be some tradeoff for API design. It may sacrifice performance if have all the layer properties available at the map service level. Lazy loading can get better performance but you will need to get the info via ajax calls once in need. It's always hard to balance how to get the best performance and the most of the useful info at the same time.
Anyway, for now, REST ajax call or feature layer onLoad approach might be the best way to go. Please let me know there is a better way.
An alternative way is to create a feature layer for each layer in the map service, and you can get the geometry type using featLayer.geometryType property inside the onLoad callback function. But I don't think it will be any better than using the REST API directly unless you will need to operate with the feature layer.
Unfortunately, lots of layer properties won't be available until the layer is loaded. There will be some tradeoff for API design. It may sacrifice performance if have all the layer properties available at the map service level. Lazy loading can get better performance but you will need to get the info via ajax calls once in need. It's always hard to balance how to get the best performance and the most of the useful info at the same time.
Anyway, for now, REST ajax call or feature layer onLoad approach might be the best way to go. Please let me know there is a better way.
A couple of reasons come to mind as to why one would want to know the geometry type. Since you can enable reordering 'layers' in services, suppose you wanted to move all of the points to the top and polygons to the bottom. Also it'd be helpful, in my case to know the goemetry type for changing symbology.
in the research that i've done it looks like this is the only option
hopefully you aren't being forced to reorder layers in a service to accomplish something like this too often. its a cartographic best practice to order based on geometry in the map itself.
A typical map might have an image or a terrain base (such as shaded relief or elevation contours) near the bottom. Next, comes basemap polygon features, followed by line and point features near the top.
im not i actually, use a dojo drag and drop process to accomplish the reorder of layers. For this though i am trying to allow the user to change the symbology of the layer in the map