| Message |
I have a MapServer based on an MXD-document running on an ArcGIS server 9.2 and wants to export a part of the map as a bitmap. I connect using a C# webservice I've written using Arcobjects.
I have a problem using IExporter.StartExporting and IActiveView.Output. The provided code works as expected, i.e it exports a bitmap and a world file of the selected extent in the correct pixel dimension. However, it only works for small bitmaps, up to somehing like 800*800 pixles. If the bitmap is bigger it creates a file with the correct pixel dimension but it is empty (all white). No exception whatsoever is thrown.
It does not seem to be related to the setting of MaxImageHeight and MaxImageWidth in IMapServerInit, which controls the size when using IMapServer.ExportMapImage. I have tried both exportJPEG and exportBMP with the same result. I could use IMapServer.ExportMapImage and create the world file myself, but I would like to have ArcGIS server create the world file for me.
Anyone got any ideas? Is there a setting somewhere I haven't found or am I doing something wrong, or is this a limitation by design or a bug?
Any help would be greatly appreciated,
Stefan |
| |
IMapServerObjects mapServerObjs = (IMapServerObjects)GetMapServer();
IMap pMap = mapServerObjs.get_Map("");
IActiveView pActiveView = (IActiveView)pMap;
IEnvelope pKoord = (IEnvelope)_context.GetServerContext().CreateObject("esriGeometry.Envelope");
IEnvelope pixlarenv = (IEnvelope)_context.GetServerContext().CreateObject("esriGeometry.Envelope");
ESRI.ArcGIS.Output.IExport pExporter = (ESRI.ArcGIS.Output.IExport)_context.GetServerContext().CreateObject("esriOutput.ExportBMP");
ESRI.ArcGIS.Display.tagRECT pixlar;
minX = 1663228;
minY = 7051490;
maxX = 1664135;
maxY = 7051916;
pKoord.PutCoords(minX, minY, maxX, maxY);
pixlar.right = (int)((maxX - minX) / metersPerPixel);
pixlar.top = (int)((maxY - minY) / metersPerPixel);
pixlar.left = 0;
pixlar.bottom = 0;
pixlarenv.PutCoords(pixlar.left, pixlar.bottom, pixlar.right, pixlar.top);
pExporter.Resolution = dpi;
pExporter.ExportFileName = filnamn + ext;
pExporter.PixelBounds = pixlarenv;
ESRI.ArcGIS.Output.IWorldFileSettings worldfile = (ESRI.ArcGIS.Output.IWorldFileSettings)pExporter;
worldfile.OutputWorldFile = true;
worldfile.MapExtent = pKoord;
int HDC = pExporter.StartExporting();
pActiveView.Output(HDC, dpi, ref pixlar, pKoord, null);
pExporter.FinishExporting();
pExporter.Cleanup(); |