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">
                        &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#008080;">Uri </span>host = new <span style="color:#008080;">Uri</span>(<span style="color:#800000;">&quot;http://msvm/mapguide/mapagent/mapagent.fcgi&quot;</span>);<br />
                        &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#008080;">IServerConnection </span>conn = <span style="color:#008080;">ConnectionProviderRegistry</span>.CreateConnection(<span style="color:#800000;">&quot;Maestro.Http&quot;</span>, <span style="color:#800000;">&quot;Url&quot;</span>, host.ToString(),<span style="color:#800000;"> &quot;Username&quot;</span>, <span style="color:#800000;">&quot;Administrator&quot;</span>, <span style="color:#800000;">&quot;Password&quot;</span>, <span style="color:#800000;">&quot;admin&quot;</span>);<br />
                        &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#008080;">IMappingService </span>mapSvc = (<span style="color:#008080;">IMappingService</span>)conn.GetService((int)<span style="color:#008080;">ServiceType</span>.Mapping);<br />
                        &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#008080;">ResourceIdentifier </span>resId = new <span style="color:#008080;">ResourceIdentifier</span>(<span style="color:#800000;">&quot;Library://Test/MyMap.MapDefinition&quot;</span>);<br />
                        &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#008080;">IMapDefinition </span>mdf = (<span style="color:#008080;">IMapDefinition</span>)conn.ResourceService.GetResource(resId);<br />
                        &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000ff;">double </span>metersPerUnit = 1.0;<br />
                        <span style="color:#008000;">/* &nbsp; &nbsp; &nbsp;</span>if (!string.IsNullOrEmpty(mdf.CoordinateSystem))<br />
                        <span style="color:#008000;">&nbsp; &nbsp; &nbsp; &nbsp; {</span><br />
                        <span style="color:#008000;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MgCoordinateSystemFactory factory = new MgCoordinateSystemFactory(); // &lt;-- This Throws a target of an invocation exception, but never mind</span><br />
                        <span style="color:#008000;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; MgCoordinateSystem cs = factory.Create(mdf.CoordinateSystem);</span><br />
                        <span style="color:#008000;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; metersPerUnit = cs.ConvertCoordinateSystemUnitsToMeters(1.0);</span><br />
                        <span style="color:#008000;">&nbsp; &nbsp; &nbsp; &nbsp; }*/</span><br />
                        &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#008080;">ResourceIdentifier </span>rtMapId = new <span style="color:#008080;">ResourceIdentifier</span>(resId.Name, ResourceTypes.RuntimeMap, conn.SessionID);&nbsp;<br />
                        &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#008080;">RuntimeMap </span>map = mapSvc.CreateMap(rtMapId, mdf, metersPerUnit);&nbsp;<br />
                        &nbsp; &nbsp; &nbsp; &nbsp; map.DisplayWidth = 640;<br />
                        &nbsp; &nbsp; &nbsp; &nbsp; map.DisplayHeight = 480;<br />
                        &nbsp; &nbsp; &nbsp; &nbsp; map.DisplayDpi = 96;<br />
                        &nbsp; &nbsp; &nbsp; &nbsp; map.BackgroundColor = <span style="color:#008080;">Color</span>.White;<br />
                        &nbsp; &nbsp; &nbsp; &nbsp; map.DataExtent = <span style="color:#008080;">ObjectFactory</span>.CreateEnvelope(505468, 6276258, 539925, 6320454);<br />
                        &nbsp; &nbsp; &nbsp; &nbsp; map.Save();<br />
                        &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;<br />
                        &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000ff;">byte</span>[] buf = <span style="color:#0000ff;">new byte</span>[1024];<br />
                        &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000ff;">using </span>(<span style="color:#008080;">Stream</span> stream = mapSvc.RenderDynamicOverlay(map, null,<span style="color:#800000;"> &quot;PNG&quot;</span>))<br />
                        &nbsp; &nbsp; &nbsp; &nbsp; {<br />
                        &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <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;">&quot;RenderMap.png&quot;</span>, <span style="color:#008080;">FileMode</span>.OpenOrCreate))<br />
                        &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
                        &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000ff;">int </span>read = 0;<br />
                        &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; do<br />
                        &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />
                        &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color:#0000ff;">read </span>= stream.Read(buf, 0, buf.Length);<br />
                        &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fs.Write(buf, 0, read);<br />
                        &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; } <span style="color:#0000ff;">while </span>(read &gt; 0);<br />
                        &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />
                        &nbsp; &nbsp; &nbsp; &nbsp; }<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/>