enzensbe

export map image

Discussion created by enzensbe on Sep 15, 2012
Latest reply on Oct 5, 2012 by dlednik-esristaff
Hi,

i need to create map images by opening an Mxd file and export an image.
i use IMapServer::ExportMapImage(...) to create a map image,
in general this works.

But how can i set a SpatialReference for the images which is different from Mxd file ?
All exported images should be created in esriSRGeoCSType::esriSRGeoCS_WGS1984

This code will not work:

ISpatialReferenceFactoryPtr sRefEnv(CLSID_SpatialReferenceEnvironment);
IGeographicCoordinateSystemPtr pGeoSys;
esriSRGeoCSType egt = esriSRGeoCSType::esriSRGeoCS_WGS1984;
sRefEnv->CreateGeographicCoordinateSystem(egt,&pGeoSys);
ISpatialReferencePtr pSrc = pGeoSys;

//pMapDesc is type of IMapDescription interface
pMapDesc->putref_SpatialReference(pSrc);

//if i set putref_SpatiaReference like above, this call crashes
// pMapServer is type of IMapServer interface
pMapServer->ExportMapImage(...)

any idea what is wrong ?

Outcomes