通过图层的名字得到图层

 通过图层的名字得到图层
private ILayer GetLayerByName(IMap map, string layerName)
{
ILayer retVal = null;

//{E156D7E5-22AF-11D3-9F99-00C04F6BC78E} IGeoFeatureLayer
ESRI.ArcGIS.esriSystem.UID uid = new UIDClass();
uid.Value = “{E156D7E5-22AF-11D3-9F99-00C04F6BC78E}”;
IEnumLayer enumLayer = map.get_Layers(uid,true);
enumLayer.Reset();
ILayer layer = enumLayer.Next();

while(layer != null)
{
if(layer.Name.ToString() == layerName)
{
retVal = layer;
break;
}
layer = enumLayer.Next();
}

return retVal;

转载自:https://blog.csdn.net/mydriverc/article/details/1678443

You may also like...