Geometry Type Dynamic Map Service

1331
7
Jump to solution
08-16-2013 12:16 PM
JamesGormley
New Contributor II
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]
0 Kudos
1 Solution

Accepted Solutions
JasonZou
Occasional Contributor III
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.

View solution in original post

0 Kudos
7 Replies
JasonZou
Occasional Contributor III
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.
0 Kudos
JamesGormley
New Contributor II
thanks i thought of that.  It seems like the geometry type would/should be part of the layerInfos property.
JohnGravois
Frequent Contributor
since you aren't working with clientside geometries when using ArcGISDynamicMapServiceLayer, what is the benefit of knowing their type?
0 Kudos
JasonZou
Occasional Contributor III
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.
0 Kudos
JamesGormley
New Contributor II
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
0 Kudos
JohnGravois
Frequent Contributor
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.

http://resources.arcgis.com/en/help/main/10.1/index.html#//006600000006000000
excerpt from the help article above:
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.
0 Kudos
JamesGormley
New Contributor II
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
0 Kudos