Select to view content in your preferred language

export map image

2464
1
09-15-2012 06:12 AM
konradenzensberger
Emerging Contributor
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 ?
0 Kudos
1 Reply
DavidLednik
Frequent Contributor
Hi,

On Server the projection is "locked" to the first layer in the mxd list and all other dynamic layers are automatically reprojected
to that projection. So I think it's a dead end street.

What might work is open your MXD in mapcontrol (or in memory) like you would in ArcMap;
change the projection there and create an image from that.

Regards,
David
0 Kudos