C#AE投影坐标系变换

 pFeatureLayer为要素图层,gcsType代表坐标代号(例如:4214代表Beijing1954)

try
            {
                IFeatureClass pFeatureClass = pFeatureLayer.FeatureClass;
                IGeoDataset pGeoDataset = pFeatureClass as IGeoDataset;
                IGeoDatasetSchemaEdit pGeoDatasetSchemaEdit = pGeoDataset as IGeoDatasetSchemaEdit;
                if (pGeoDatasetSchemaEdit.CanAlterSpatialReference == true)
                {
                    ISpatialReferenceFactory2 pSpaRefFactory = new SpatialReferenceEnvironmentClass();
                    IProjectedCoordinateSystem pNewProSys = pSpaRefFactory.CreateProjectedCoordinateSystem(gcsType);  
                    pGeoDatasetSchemaEdit.AlterSpatialReference(pNewProSys);
                }
            }
            catch (Exception Err)
            {
                MessageBox.Show(Err.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

猜你喜欢

转载自blog.csdn.net/qq_38370387/article/details/89188631