Get Layer GeometryType

686
2
11-26-2012 07:18 AM
Udaya_BhaskerCheerala
New Contributor
Dear All,
Iam using DynamicMapServiceLayer in my map. I need to get the layer geometryType weather it is line or polygon or point. How can I get it.

Thanks,
Uday
0 Kudos
2 Replies
Udaya_BhaskerCheerala
New Contributor
Hi All,

Anyone found solutions for this?

Thanks,
Uday
0 Kudos
derekswingley1
Frequent Contributor
An ArcGISDynamicMapServiceLayer is used to display a map service in a JS API app and is collection of one or more layers. As a result, dynamic layers don't have a geometry type but individual layers in the map service do have a geometry type.

Take a look at the Census map service on one of our sample servers:  http://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer

There are four layers, each with a geometry type. You can get an individual layer's geometry type by sending a request to that layer's endpoint, for instance:  http://sampleserver6.arcgisonline.com/arcgis/rest/services/Census/MapServer/0?f=pjson

We have a sample showing how to retrieve individual layer info. To get geometry type, you would use the same code shown in that sample but instead of pulling out field info, you'd pull out the layer's geometry type.
0 Kudos