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();
                    IGeographicCoordinateSystem pNewGeoSys = pSpaRefFactory.CreateGeographicCoordinateSystem(gcsType);
                    pGeoDatasetSchemaEdit.AlterSpatialReference(pNewGeoSys);
                }
            }
            catch (Exception Err)
            {
                MessageBox.Show(Err.Message, "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }

猜你喜欢

转载自blog.csdn.net/qq_38370387/article/details/89188603
今日推荐