读取shp文件并把shp文件添加到地图中
pMap.AddLayer(pLayer);
public ILayer GetIlayerByShapefile(string path, string fileName)
{
IWorkspaceFactory pWorkspaceFactory = new ShapefileWorkspaceFactoryClass();
IWorkspace pWorkspace = pWorkspaceFactory.OpenFromFile(path, 0);
IFeatureWorkspace pFeatureWorkspace = pWorkspace as IFeatureWorkspace;
IFeatureClass pFeatureClass = pFeatureWorkspace.OpenFeatureClass(fileName);
IDataset pDataset = pFeatureClass as IDataset;
IFeatureLayer pFeatureLayer = new FeatureLayerClass();
pFeatureLayer.FeatureClass = pFeatureClass;
pFeatureLayer.Name = pDataset.Name;
ILayer pLayer = pFeatureLayer as ILayer;
return pLayer;
}