[mapguide-users] Mapguide maps using openlayers

Rodolfo Moreno rmoreno at voxiva.com
Mon Nov 17 15:03:14 EST 2008


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).
http://n2.nabble.com/file/n1511002/MGusingOL.jpg 

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


-----
Rodolfo Moreno
CivilEng

-- 
View this message in context: http://n2.nabble.com/Mapguide-maps-using-openlayers-tp1511002p1511002.html
Sent from the MapGuide Users mailing list archive at Nabble.com.



More information about the mapguide-users mailing list