Hello all,
I may just be being dim on a Monday afternoon, but I can't seem to find any way of finding a layer's specified geometry type. This is shown in the REST endpoint as "Geometry Type: esriGeometryPoint"; unfortunately it doesn't seem to be exposed in either the Layer properties, or in the layerInfos object.
What I need to do is create a custom-symbolised featureLayer on the fly, and in order for that to work I need to know the geometry present in this particular layer.
Sadly, I can't use layerDefinitions (which would be far more appropriate).
Any ideas?
- Ben
FeatureLayer.geometryType.
Hi Heming,
thanks - turns out I am being dim on a Monday. Create the feature layer, *then* find the geometry type, symbolise accordingly.
It is a little strange that the type isn't accessible without first creating a featureLayer; I'd expect that to be in layerInfos[layerId], or similar.
Cheers,
Ben.
I agreed with you on that.
anFeatureLayer = new esri.layers.FeatureLayer("http://server/ArcGIS/rest/services/service/FeatureServer/0", {mode: esri.layers.FeatureLayer.MODE_SELECTION}); geomType = anFeatureLayer.geometryType alert(geomType)
Yes - I think being able to expose the geometry type of the (sub) layers could be useful for many, many reasons. I'm surprised this isn't in layerInfos, actually. It's a little silly to have to create a feature layer just to get at this.
The reason it's not exposed is because not all layers are feature layers. Some layers are rasters.
So what should I do if the geometry type is blank in the map service for a point layer? I have some point layers that are set to "esriGeometryPoint", but others are just blank. This causes a problem when trying to work with the ArcGIS Viewer for Silverlight. I cannot use the layer because the geometry type is "unspecified". How do I set the geometry type of an unspecified layer?
Here's an example of a point layer with an unspecified geometry type:
http://ndep-emap.nv.gov/ArcGIS/rest/services/eMap/MapServer/17