[mapguide-users] RenderMap in C#
Andy Morsell
amorsell at spatialgis.com
Tue Jul 31 12:01:29 EDT 2007
Hi Jim,
The below code works for me when I worked on a similar application awhile
back.
MgColor bgcolor = new MgColor(0,0,0,0);
MgByteReader byteReader = renderingService.RenderMap(map, selection,
envelop, 600, 600, bgcolor, "png" );
long byteReaderSize = byteReader.GetLength();
//Create an MgByteSink and save to the file system
MgByteSink byteSink = new MgByteSink(byteReader);
string fileName = "c:\\temp\\test" + i + ".png";
byteSink.ToFile(fileName);
Andy Morsell, P.E.
Spatial Integrators, Inc.
http://www.SpatialGIS.com
-----Original Message-----
From: mapguide-users-bounces at lists.osgeo.org
[mailto:mapguide-users-bounces at lists.osgeo.org] On Behalf Of Jim O'Leary
Sent: Tuesday, July 31, 2007 8:06 AM
To: mapguide-users at lists.osgeo.org
Subject: [mapguide-users] RenderMap in C#
I'm implementing the createimagemap.php DevGuide sample in C#. When I use
"GIF" as the format argument to RenderMap I see a blank image with a brown
background (which is the color argument). When I use PNG or JPG I just see a
blank image.
Here's my C# code.
MgByteReader byteReader = renderingService.RenderMap(map, selection,
envelope, width, height, color, "PNG");
Response.AddHeader("Content-type: ", byteReader.GetMimeType() );
byte[] buffer= new byte[50000];
while (byteReader.Read(buffer, 50000) != 0) {
Response.BinaryWrite(buffer);
}
Any suggestions? I've also tried Response.Buffer and Response.BufferOutput
to no effect.
Thanks.
--
View this message in context:
http://www.nabble.com/RenderMap-in-C--tf4193602s16610.html#a11925975
Sent from the MapGuide Users mailing list archive at Nabble.com.
_______________________________________________
mapguide-users mailing list
mapguide-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-users
More information about the mapguide-users
mailing list