[mapguide-users] Trouble with rendering service
Kenneth, GEOGRAF A/S
ks at geograf.dk
Fri Nov 30 16:52:11 EST 2007
I have not used this for a while, as I found it borderline useless with
the reader complications.
As I recall, you cannot exhaust the MgByteReader by a single call.
You must itterate over the reader, and read 8K blocks for each itteration.
As I wrote, you should be able to find working code by searhing the posts.
If you find it, the Code Wiki is at:
http://trac.osgeo.org/mapguide/wiki/CodeSamples
Regards, Kenneth, GEOGRAF A/S
monegodj skrev:
> 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
>>
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapguide-users/attachments/20071130/7809e278/attachment.html
More information about the mapguide-users
mailing list