<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
The Firebug shows that you newer send a request to the MapGuide server.<br>
Is there something missing, or are you never calling the init()
function?<br>
<pre class="moz-signature" cols="72">Regards, Kenneth Skovhede, GEOGRAF A/S
</pre>
<br>
<br>
Rodolfo Moreno skrev:
<blockquote cite="mid:1227021970112-1514643.post@n2.nabble.com"
 type="cite">
  <pre wrap="">Hi Kenneth,
Here is the javascript code. It's similar to the posted in the wiki
(<a class="moz-txt-link-freetext" href="http://trac.osgeo.org/mapguide/attachment/wiki/CodeSamples/JavaScript/OpenlayersExample/sheboygan.php">http://trac.osgeo.org/mapguide/attachment/wiki/CodeSamples/JavaScript/OpenlayersExample/sheboygan.php</a>)

&lt;script type="text/javascript"&gt;

        var map, map2, layer;
        //var url =
<a class="moz-txt-link-rfc2396E" href="http://demo01.dmsolutions.ca/mapguide/mapagent/mapagent.fcgi">"http://demo01.dmsolutions.ca/mapguide/mapagent/mapagent.fcgi"</a>;
        //you can use this URL when MapGuide OS is installed locally
                var url = <a class="moz-txt-link-rfc2396E" href="http://localhost/mapguide/mapagent/mapagent.fcgi">"http://localhost/mapguide/mapagent/mapagent.fcgi"</a>;

        var metersPerUnit = 111319.4908;  //value returned from mapguide
        var inPerUnit = OpenLayers.INCHES_PER_UNIT.m * metersPerUnit;
        OpenLayers.INCHES_PER_UNIT["dd"] = inPerUnit;
        OpenLayers.INCHES_PER_UNIT["degrees"] = inPerUnit;
        OpenLayers.DOTS_PER_INCH = 96;


        function init(){

             var mapBounds = new
OpenLayers.Bounds(-87.764986990963,43.691398128788,-87.6955215109,43.79752000048);
        var fixedScales
=[1000,1930.6977300000001,3727.5937199999998,7196.8567300000004,13894.95494,26826.95795,51794.746789999997,100000];

            var mapOptions = {
                maxExtent: mapBounds,
                scales: fixedScales
            };
                        
            map = new OpenLayers.Map( 'map', mapOptions );                        
                        
                //tiled map
          var tiledParams = {
              mapdefinition:
'Library://Samples/Sheboygan/MapsTiled/Sheboygan.MapDefinition',
              basemaplayergroupname: "Base Layer Group",
         session: '&lt;%=sessionId%&gt;'
           }

          var tiledOptions = {
              units: "dd",
              singleTile: false
            }
                        
          var tiledLayer = new OpenLayers.Layer.MapGuide( "GetTileImage", 
                                url, 
                                tiledParams, 
                                tiledOptions );
          map.addLayer(tiledLayer);
                        
         //un-tiled versions

         var dynamicOverlayOptions = {
              buffer: 1,
              singleTile: true,
          isBaseLayer : false,
          visibility : false
         };

         var mapImageOptions = {
              buffer: 1,
              singleTile: true,
         isBaseLayer : true
         };

        var untiledParams = {
        session: '&lt;%=sessionId%&gt;',
             mapname: 'Sheboygan'
        };

        var dynamicLayer = new OpenLayers.Layer.MapGuide(
"GetDynamicMapOverlayImage", 
        url, 
        untiledParams, 
        dynamicOverlayOptions );
        map.addLayer(dynamicLayer);
                        
        var mapImageLayer = new OpenLayers.Layer.MapGuide( "GetMapImage", 
        url, 
        untiledParams, 
        mapImageOptions );
        map.addLayer(mapImageLayer);

        map.zoomToMaxExtent();

        map.addControl(new OpenLayers.Control.MousePosition());
        map.addControl(new OpenLayers.Control.Scale());
                        
        var switcher=new OpenLayers.Control.LayerSwitcher();
        map.addControl(switcher);
        switcher.maximizeControl();

        }
    &lt;/script&gt;

The sessionId is returned as parameter to openlayers and the mapname is
hard-coded as 'Sheboygan'
only for the untiled version layer.

Also I have tested it with FF and firebug, I have gotten the same result
(see the image attached).

Regards,


Kenneth Skovhede, GEOGRAF A/S wrote:
  </pre>
  <blockquote type="cite">
    <pre wrap="">How do you return the map name and sessionId to OpenLayers?

If you use Firebug (in Firefox), the "Net" tab will show you any errors 
thrown by MapGuide.
<a class="moz-txt-link-freetext" href="http://getfirebug.com/">http://getfirebug.com/</a>

Regards, Kenneth Skovhede, GEOGRAF A/S



Rodolfo Moreno skrev:
    </pre>
    <blockquote type="cite">
      <pre wrap="">Hi all,
I have tried to port the wiki sample "display mapguide maps using
openlayers" from PHP to .NET without successful.

The javascript code is the same of the example, the difference is the
SERVER
CODE. It's my .NET CODE:

public partial class OLViewer : System.Web.UI.Page
{
    public String sessionId;
    protected void Page_Load(object sender, EventArgs e)
    {
        try
        {
            // Initialize the web tier
            Utility utility = new Utility(Request);
            utility.InitializeWebTier();

            MgUserInformation userInfo = new
MgUserInformation("Anonymous",
"");

            MgSiteConnection siteCnn = new MgSiteConnection();
            siteCnn.Open(userInfo);

            MgSite site = siteCnn.GetSite();
            sessionId = site.CreateSession();

            userInfo.SetMgSessionId(sessionId);

            MgResourceService resourceService =
(MgResourceService)siteCnn.CreateService(MgServiceType.ResourceService);
            MgMappingService mappingService =
(MgMappingService)siteCnn.CreateService(MgServiceType.MappingService);

            MgResourceIdentifier resId = new
MgResourceIdentifier("Library://Samples/Sheboygan/Maps/Sheboygan.MapDefinition");

            MgMap map = new MgMap();
            map.Create(resourceService, resId, "Sheboygan");

            MgSelection sel = new MgSelection(map);
            sel.Save(resourceService, "Sheboygan");

            MgResourceIdentifier mapStateId = new
MgResourceIdentifier("Session:" + sessionId + "//" + "Sheboygan." +
MgResourceType.Map);
            map.Save(resourceService, mapStateId);

        }
        catch (Exception er)
        {
            Response.Write(er.Message);
        }
    }
}

when I run the sample the Page is shown but not the map. (see attached
image).
<a class="moz-txt-link-freetext" href="http://n2.nabble.com/file/n1511002/MGusingOL.jpg">http://n2.nabble.com/file/n1511002/MGusingOL.jpg</a> 

I don't know what is the error.
I'd appreciate so much your suggestions.


-----
Rodolfo Moreno
CivilEng

  
      </pre>
    </blockquote>
    <pre wrap="">_______________________________________________
mapguide-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:mapguide-users@lists.osgeo.org">mapguide-users@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/mapguide-users">http://lists.osgeo.org/mailman/listinfo/mapguide-users</a>


    </pre>
  </blockquote>
  <pre wrap=""><!----><a class="moz-txt-link-freetext" href="http://n2.nabble.com/file/n1514643/FirebugTest.jpg">http://n2.nabble.com/file/n1514643/FirebugTest.jpg</a> 

-----
Rodolfo Moreno
CivilEng

  </pre>
</blockquote>
</body>
</html>