[mapguide-users] Mapguide maps using openlayers
Kenneth Skovhede, GEOGRAF A/S
ks at geograf.dk
Tue Nov 18 05:47:28 EST 2008
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.
http://getfirebug.com/
Regards, Kenneth Skovhede, GEOGRAF A/S
Rodolfo Moreno skrev:
> 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
>
>
More information about the mapguide-users
mailing list