添加引用ESRI.ArcGIS.DataManagementTools
1.获取要定义和要转换的投影
IWorkspaceFactory wsf = new ShapefileWorkspaceFactoryClass();
IWorkspace ws = wsf.OpenFromFile(strProjPath,);
IFeatureClass fc = (ws as IFeatureWorkspace).OpenFeatureClass("路中心线");
ProSpaRef = (fc as IGeoDataset).SpatialReference;
IFeatureClass fc1 = (ws as IFeatureWorkspace).OpenFeatureClass("路中心线_Project");
GeoSpaRef = (fc1 as IGeoDataset).SpatialReference;
2.为shp文件定义投影
Geoprocessor gp = new Geoprocessor();
DefineProjection defPro = new DefineProjection();
defPro.in_dataset = strFile;
defPro.coor_system = ProSpaRef;
gp.Execute(defPro, null);
3.投影转换
Project defGeo = new Project();
defGeo.in_dataset = strFile;
defGeo.in_coor_system = ProSpaRef;
defGeo.out_coor_system = GeoSpaRef;
defGeo.out_dataset = strFoldPath + @"\" + strNewname + strExtension;
gp.Execute(defGeo, null);