AE设置投影而非重投影
读取一个jpg格式的影像,包含jgw文件,这时设置投影。赋值操作。
IRasterDataset raster = rasterWsp.OpenRasterDataset(FileName);
//AE设置投影为WebMercator投影
IGeoDatasetSchemaEdit schemeEdit = raster as IGeoDatasetSchemaEdit;
if (schemeEdit.CanAlterSpatialReference)
{
schemeEdit.AlterSpatialReference(webMercator);
}
构建webMercator投影:
//创建WGS84辅助球Web墨卡托投影
public ISpatialReference CreateWebMector()
{
// 实例化SpatialReferenceEnvironment.SpatialReferenceEnvironment
Type factoryType = Type.GetTypeFromProgID("esriGeometry.SpatialReferenceEnvironment");
System.Object obj = Activator.CreateInstance(factoryType);
ISpatialReferenceFactory3 mSpatialReferenceFactory3 = obj as ISpatialReferenceFactory3;
ISpatialReference projSpatialReference = mSpatialReferenceFactory3.CreateProjectedCoordinateSystem((int)esriSRProjCS3Type.esriSRProjCS_WGS1984WebMercatorMajorAuxSphere);//基于WGS84的WebMercator
//esriSRProjCS2Type.esriSRProjCS_WGS1984WorldMercator);
//esriSRProjCS3Type.esriSRProjCS_WGS1984WebMercatorMajorAuxSphere);
//esriSRProjCS2Type.esriSRProjCS_WGS1984SphereWebMercator
return projSpatialReference;
}
CreateWebMector