private esriGeometryType GetLayerGeometryType(IMapLayerInfos layerInfos, int layerIndex)
{
IMapLayerInfo3 layerInfo;
// Find the index of the layer of interest.
int layerCount = layerInfos.Count;
for (int i = 0; i < layerCount; i++)
{
layerInfo = layerInfos.get_Element(i) as IMapLayerInfo3;
if (layerInfo.ID == layerIndex)
{
return this.GetGeometryTypeFromFields(layerInfo.Fields);
}
}
throw new InvalidOperationException(string.Format("Unable to locate layerId [{0}] in map service. Please check the map service REST API to ensure this layer index exists.", layerIndex));
}