/// <summary>
/// 设置地理投影
/// 4490:GCS_China_Geodetic_Coordinate_System_2000
/// </summary>
/// <param name="pFc"></param>
/// <param name="yFc"></param>
private void setGeographicCoordinateSysteme(IFeatureClass targetFc, int gcsType = 4490)
{
IGeoDataset pGeoDataset = targetFc as IGeoDataset;
IGeoDatasetSchemaEdit pGeoDatasetSchemaEdit = pGeoDataset as IGeoDatasetSchemaEdit;
if (pGeoDatasetSchemaEdit.CanAlterSpatialReference == true)//空间坐标系可改变
{
ISpatialReferenceFactory spatialReferenceFactory = new SpatialReferenceEnvironmentClass();
ISpatialReference pSpatialRef = spatialReferenceFactory.CreateGeographicCoordinateSystem(gcsType);
string name = pSpatialRef.Name;
ISpatialReferenceTolerance targetSpatialReferenceTolerance = pSpatialRef as ISpatialReferenceTolerance;
ISpatialReferenceTolerance sourceSpatialReferenceTolerance = pGeoDataset.SpatialReference as ISpatialReferenceTolerance;
//必须设置容差,否则将采用坐标系的默认容差,导致与源坐标系的容差不统一
targetSpatialReferenceTolerance.XYTolerance = sourceSpatialReferenceTolerance.XYTolerance;
targetSpatialReferenceTolerance.ZTolerance = sourceSpatialReferenceTolerance.ZTolerance;
targetSpatialReferenceTolerance.MTolerance = sourceSpatialReferenceTolerance.MTolerance;
pGeoDatasetSchemaEdit.AlterSpatialReference(pSpatialRef);
}
}