[mapguide-users] MAPNAME & Map.Open
Mark Pendergraft
markp at Meadgilman.com
Wed Jun 27 22:56:25 EDT 2007
I'm hoping that someone can help me with a few questions:
1) How are people passing the MAPNAME variable to their application
pages? I understand that you can use the javascript function
parent.parent.mapframe.getmapname, however, I am unsure how to retain
the value from this. How do I transfer this variable to my asp.net
page.
2) I am unable to open a Map at all. Every app I have made so far
creates a map. My code thus far:
<!-- #Include File="../UtilityFunctions.aspx" -->
<script runat="server">
Private webLayout As String =
"Library://Kroll/Layout/MGAJobMapLayout.WebLayout"
Private MapDef As String = "Library://Kroll/Map/MGA.MapDefinition"
Private defaultUser As String = "Anonymous"
Private defaultPassword As String = ""
Private sessionId As String = ""
</script>
<%
Try
InitializeWebTier()
Dim SessionId As String = GetRequestParameters("SESSION")
Dim UserInfo As New MgUserInformation(defaultUser,
defaultPassword)
Dim site As New MgSite()
site.Open(UserInfo)
'for testing purposes only
If SessionId = "" Then site.CreateSession()
'for testing purposes only
Dim ResourceService As OSGeo.MapGuide.MgResourceService
Dim siteconnection As New MgSiteConnection
siteconnection.Open(UserInfo)
ResourceService =
siteconnection.CreateService(MgServiceType.ResourceService)
Dim MapDefId As New MgResourceIdentifier(MapDef)
Dim MapName As String = MapDefId.Name
Dim Map As New MgMap(siteconnection)
Map.Open(ResourceService, MapName)
Dim srs As String = Map.GetMapSRS
Response.Write("Map <strong>" + Map.GetName + "</strong> uses
this reference system: </br>" + srs + "</br></br></br>")
Dim MapLayers As MgLayerCollection
MapLayers = Map.GetLayers
Dim Layer As MgLayer
Response.Write("<strong>Map Layers</strong></br>")
For Each Layer In MapLayers
Response.Write(Layer.Name + "</br>")
Next
Catch ex As Exception
Response.Write(ex.Message)
Response.Write(ex.StackTrace)
End Try
%>
This code errors out at Map.Open everytime
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapguide-users/attachments/20070627/d57cc990/attachment.html
More information about the mapguide-users
mailing list