[mapguide-users] Trouble with rendering service

monegodj MonegoDJ at cdm.com
Thu Nov 29 16:48:54 EST 2007


This snippet is where I connect to the rendering service, call it, and then
write to the HTML response (and to file, to test the call). I've cut out
setting up the selection and the map connection (sel and map) to keep this
brief.


        ...

        MgRenderingService sRendering =
(MgRenderingService)connection.CreateService(MgServiceType.RenderingService);
        MgByteReader mapguideImageData = sRendering.RenderMap(map, sel,
"JPG");
        byte[] imageData = new byte[mapguideImageData.GetLength()];
        mapguideImageData.Read(imageData, 0);
        Response.ContentType = mapguideImageData.GetMimeType();
        Response.BinaryWrite(imageData);
        Response.End();
        FileStream f = (new
FileInfo(@"D:\test.jpg")).Open(FileMode.OpenOrCreate, FileAccess.Write);
        using(f)
        {
            foreach(byte b in imageData)
            {
                f.WriteByte(b);
            }
        }


Kenneth, GEOGRAF A/S wrote:
> 
> I have worked some with the rendering service in .Net.
> Is the byte array the size you expect?
> Can you post a code snippet with the code you try to run?
> 
> Regards, Kenneth, GEOGRAF A/S
> 

-- 
View this message in context: http://www.nabble.com/Trouble-with-rendering-service-tf4899291s16610.html#a14035945
Sent from the MapGuide Users mailing list archive at Nabble.com.



More information about the mapguide-users mailing list