首页 > 代码库 > AE设置投影而非重投影IGeoDatasetSchemaEdit

AE设置投影而非重投影IGeoDatasetSchemaEdit

 AE设置投影而非重投影

读取一个jpg格式的影像,包含jgw文件,这时设置投影。赋值操作。

1 IRasterDataset raster = rasterWsp.OpenRasterDataset(FileName);2 //AE设置投影为WebMercator投影3 IGeoDatasetSchemaEdit schemeEdit = raster as IGeoDatasetSchemaEdit;4  if (schemeEdit.CanAlterSpatialReference)5 {6           schemeEdit.AlterSpatialReference(webMercator);7 }

 构建webMercator投影:

 1  //创建WGS84辅助球Web墨卡托投影 2         public ISpatialReference CreateWebMector() 3         { 4             // 实例化SpatialReferenceEnvironment.SpatialReferenceEnvironment 5             Type factoryType = Type.GetTypeFromProgID("esriGeometry.SpatialReferenceEnvironment"); 6             System.Object obj = Activator.CreateInstance(factoryType); 7             ISpatialReferenceFactory3 mSpatialReferenceFactory3 = obj as ISpatialReferenceFactory3; 8             ISpatialReference projSpatialReference = mSpatialReferenceFactory3.CreateProjectedCoordinateSystem((int)esriSRProjCS3Type.esriSRProjCS_WGS1984WebMercatorMajorAuxSphere);//基于WGS84的WebMercator 9             //esriSRProjCS2Type.esriSRProjCS_WGS1984WorldMercator);10             //esriSRProjCS3Type.esriSRProjCS_WGS1984WebMercatorMajorAuxSphere);11             //esriSRProjCS2Type.esriSRProjCS_WGS1984SphereWebMercator12             return projSpatialReference;13         }
CreateWebMector

 

AE设置投影而非重投影IGeoDatasetSchemaEdit