<%@ Page language="c#" %> <%@ Import Namespace="System" %> <%@ Import Namespace="System.Collections.Specialized" %> <%@ Import Namespace="System.IO" %> <%@ Import Namespace="OSGeo.MapGuide" %> Hello, map

Spatial Reference

<% // Get the directory paths for this MapGuide installation try { // --------------------------------------------------// // Basic initialization needs to be done every time. MapGuideApi.MgInitializeWebTier(Constants.WebConfigPath); // Get the session information passed from the viewer. String sessionId = Request.Params["SESSION"]; String mapName = Request.Params["MAPNAME"]; // Get the user information using the session id, // and set up a connection to the site server. MgUserInformation userInfo = new MgUserInformation(sessionId); MgSiteConnection siteConnection = new MgSiteConnection(); siteConnection.Open(userInfo); // Get an instance of the required service(s). MgResourceService resourceService = (MgResourceService)siteConnection.CreateService(MgServiceType.ResourceService); // Finished basic initialization. // --------------------------------------------------// // Query the spatial reference system used for the map. MgMap map = new MgMap(siteConnection); map.Open(mapName); String srs = map.GetMapSRS(); // Format it and display it in the task pane. Response.Write("

Map " + map.GetName() + " uses this reference system:

"); Response.Write("
" + srs + "
"); } catch (MgException ex) { Response.Write("

Error: "); Response.Write(ex.GetDetails()); Response.Write("

"); } %>