You are here: > ESRI Forums > arcgis server forums > Thread Replies

ArcGIS Server Forums

ArcGIS Server .Net: General questions forum

IExporter.StartExporting only works on smal...   Stefan Forsgren Aug 30, 2007
Re: IExporter.StartExporting only works on...   Min Lynch Nov 13, 2007
Re: IExporter.StartExporting only works on...   Stefan Forsgren Nov 16, 2007
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject IExporter.StartExporting only works on small bitmaps 
Author Stefan Forsgren 
Date Aug 30, 2007 
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();
 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: IExporter.StartExporting only works on small bitmaps 
Author Min Lynch 
Date Nov 13, 2007 
Message I am on SP3 and got the same issue here. I did following test:

RasterImage: width(px), height(px), size(MB)
test1: 3805, 3615, 4.5 - works fine
test2: 5388, 2616, 12 - works fine
test3: 8082, 3924, 27 - works fine
test4: 9698, 4709, 37 - not print
test5: 10020, 5010, 49 - not print
test6: 11550, 10845, 54 - not print

Did you find any way to up the threshold OR work arounds in the IExport code to make sure raster image export properly?

OR is it a ESRI bug that needs to be reported?
 
   
Report Inappropriate Content • Top • Print • This Forum is closed for replies.    
Subject Re: IExporter.StartExporting only works on small bitmaps 
Author Stefan Forsgren 
Date Nov 16, 2007 
Message No I haven't solved it. I spoke to Rex Hansen (server developer at ESRI) about it a while ago and he did't recollect that there would be any limitation. He wanted me to mail him a snippet to test for himself. I did, but I haven't received any answer.

It also seems strange that it would be a limitation, as when you hit the limit it would be nice to be notified with an exception, not just receiving an empty image. It also seems that the size depends on the data. If I have raster layers the biggest image I can create is smallar than if the map only contains sparse feature layers. Another thing that points to a bug is that sometimes the image contains data but it is not the correct extent and scale but the size is correct. This also only happens for large images.

My workaround is to use IMapServer.ExportMapImage, which indeed has a limit of default 2048 times 2048 pixels. It is however possible to change this limit by modifying the .cfg file for the map service. It is not possible to change this value from the Server Manager, it is only displayed there. After you change the value you must restart the SOM service.
Note that IMapServer.ExportMapImage does not throw an exception when the limit is exceeded, so it might be a good idea to test the returned image size against the server configuration. It is also possible to override the server configuration from code using IMapServerInit.

The drawback of using IMapServer.ExportMapImage is that I have to create the worldfile myself, and I have not been able to create it exact for every scale even though I have tried using both the requested size and the returned size.

/Stefan