Hi, I am trying one of the samples from the MapGuide API 4.0 website.<br />
Using MGOS 2.2 I have set up a simple map with a sigel layer based on a MapInfo tab/ind/map/dat files.<br />
Using MapGuide Maestro 3.5 (And 4.0 RC1) I can see the layer and map, no problems and no validation errors.<br />
But when I run the following sample code that just saves the map as a PNG image, the image is just a transparent blank image but with the correct with/height. Does anyone have any clue what I am missing?<br />
<br />
<div style="font-family:courier new,courier,monospace; font-size:10pt">
                         <span style="color:#008080;">Uri </span>host = new <span style="color:#008080;">Uri</span>(<span style="color:#800000;">"http://msvm/mapguide/mapagent/mapagent.fcgi"</span>);<br />
                         <span style="color:#008080;">IServerConnection </span>conn = <span style="color:#008080;">ConnectionProviderRegistry</span>.CreateConnection(<span style="color:#800000;">"Maestro.Http"</span>, <span style="color:#800000;">"Url"</span>, host.ToString(),<span style="color:#800000;"> "Username"</span>, <span style="color:#800000;">"Administrator"</span>, <span style="color:#800000;">"Password"</span>, <span style="color:#800000;">"admin"</span>);<br />
                         <span style="color:#008080;">IMappingService </span>mapSvc = (<span style="color:#008080;">IMappingService</span>)conn.GetService((int)<span style="color:#008080;">ServiceType</span>.Mapping);<br />
                         <span style="color:#008080;">ResourceIdentifier </span>resId = new <span style="color:#008080;">ResourceIdentifier</span>(<span style="color:#800000;">"Library://Test/MyMap.MapDefinition"</span>);<br />
                         <span style="color:#008080;">IMapDefinition </span>mdf = (<span style="color:#008080;">IMapDefinition</span>)conn.ResourceService.GetResource(resId);<br />
                         <span style="color:#0000ff;">double </span>metersPerUnit = 1.0;<br />
                        <span style="color:#008000;">/* </span>if (!string.IsNullOrEmpty(mdf.CoordinateSystem))<br />
                        <span style="color:#008000;"> {</span><br />
                        <span style="color:#008000;"> MgCoordinateSystemFactory factory = new MgCoordinateSystemFactory(); // <-- This Throws a target of an invocation exception, but never mind</span><br />
                        <span style="color:#008000;"> MgCoordinateSystem cs = factory.Create(mdf.CoordinateSystem);</span><br />
                        <span style="color:#008000;"> metersPerUnit = cs.ConvertCoordinateSystemUnitsToMeters(1.0);</span><br />
                        <span style="color:#008000;"> }*/</span><br />
                         <span style="color:#008080;">ResourceIdentifier </span>rtMapId = new <span style="color:#008080;">ResourceIdentifier</span>(resId.Name, ResourceTypes.RuntimeMap, conn.SessionID); <br />
                         <span style="color:#008080;">RuntimeMap </span>map = mapSvc.CreateMap(rtMapId, mdf, metersPerUnit); <br />
                         map.DisplayWidth = 640;<br />
                         map.DisplayHeight = 480;<br />
                         map.DisplayDpi = 96;<br />
                         map.BackgroundColor = <span style="color:#008080;">Color</span>.White;<br />
                         map.DataExtent = <span style="color:#008080;">ObjectFactory</span>.CreateEnvelope(505468, 6276258, 539925, 6320454);<br />
                         map.Save();<br />
                         <br />
                         <span style="color:#0000ff;">byte</span>[] buf = <span style="color:#0000ff;">new byte</span>[1024];<br />
                         <span style="color:#0000ff;">using </span>(<span style="color:#008080;">Stream</span> stream = mapSvc.RenderDynamicOverlay(map, null,<span style="color:#800000;"> "PNG"</span>))<br />
                         {<br />
                         <span style="color:#0000ff;">using </span>(<span style="color:#0000ff;">var </span>fs = <span style="color:#0000ff;">new </span><span style="color:#008080;">FileStream</span>(<span style="color:#800000;">"RenderMap.png"</span>, <span style="color:#008080;">FileMode</span>.OpenOrCreate))<br />
                         {<br />
                         <span style="color:#0000ff;">int </span>read = 0;<br />
                         do<br />
                         {<br />
                         <span style="color:#0000ff;">read </span>= stream.Read(buf, 0, buf.Length);<br />
                         fs.Write(buf, 0, read);<br />
                         } <span style="color:#0000ff;">while </span>(read > 0);<br />
                         }<br />
                         }<br />
</div><br />
Regards Hans Milling...
        
<br/><hr align="left" width="300" />
View this message in context: <a href="http://osgeo-org.1803224.n2.nabble.com/MaestroAPI-4-and-MGOS-2-2-empty-blank-transparent-map-tp7054607p7054607.html">MaestroAPI 4 and MGOS 2.2 - empty/blank/transparent map</a><br/>
Sent from the <a href="http://osgeo-org.1803224.n2.nabble.com/MapGuide-Users-f1803227.html">MapGuide Users mailing list archive</a> at Nabble.com.<br/>