DanDanAus

Export Map weird behavior - image is too small

Discussion created by DanDanAus on Jun 12, 2012
Dear all,

I am trying to export a map image from a web service. It sort of works but the image i am getting doesnt fit the area i am expecting it to fit.
Attached is the image i am getting.

Pretty much i am hoping to get an image of 400x400 with the feature shown inside. Then i was hoping to add some text labels at vertices. But havent got that far yet.

I must be doing someting stupit. Ive tried all things i could think of today.

Here is my code:

            IMapDocument ipMapDoc;
            ipMapDoc = new MapDocumentClass();
            ipMapDoc.Open(@"D:\Data\Spatial\Untitled.mxd");

            // Try the following different options to see how the code works in data or layout view:
            IActiveView activeView = ipMapDoc.ActiveView;

            IEnvelope envelope = feature.Shape.Envelope;


            ESRI.ArcGIS.Geometry.IEnvelope pEnvelope;
            pEnvelope = new EnvelopeClass();

            pEnvelope.Union(feature.Shape.Envelope);

            pEnvelope.Expand(1.2, 1.2, true);
            activeView.Extent = pEnvelope;
            
            activeView.Refresh();

            IMap myMap = ipMapDoc.get_Map(0);
            myMap.ReferenceScale = 200;

            activeView.Refresh();

            int OUTPUT_RES = 600;
            IExport export = null;

            IExportPNG pngExport = new ExportPNGClass();
            export = (IExport)pngExport;
            export.Resolution = OUTPUT_RES;

            export.ExportFileName = @"D:\Data\Spatial\myout.png";

            tagRECT exportFrame = ipMapDoc.ActiveView.ExportFrame;
            IEnvelope exportEnvelope = new EnvelopeClass();
            exportEnvelope.PutCoords(0, 0, 400, 400);
            export.PixelBounds = exportEnvelope;

            int hdc = export.StartExporting();
            ipMapDoc.ActiveView.Output(hdc, OUTPUT_RES, exportFrame, activeView.Extent, null);
            export.FinishExporting();
            export.Cleanup();


I get an image that is 400x400 but my feature doesnt really fill in like i would expect it to.

Has anyone done something similar to this?

Cheers
Dan

Attachments

Outcomes