[mapguide-users] Problem with Layer Editing
padmini godavarthi
godavarthi.padmini at gmail.com
Tue Dec 9 11:41:59 EST 2008
Hi
iam using mapguide opensource 2.0(with .net 2.0 +IIS 5.1)
i already asked the question
1)How to edit the layer
some one give me the answer as follows
Read setup from querystring or form
Dim sessionID As String = Request.Params("SESSIONID")
Dim mapdefinition As String = Request.Params("MAPDEFINITION")
Dim layername As String = Request.Params("LAYERNAME")
Dim newFilter As String = Request.Params("NEWFILTER")
'Replace "myserver" with the server name, or use "localhost"
Dim host As New Uri("http://myserver/mapguide/mapagent/mapagent.fcgi")
Dim conn as ServerConnectionI = New HttpServerConnection(host, sessionID,
"en", true)
'Use the same naming system as the viewer, when reading the runtime map ID
Dim mapName as String = new ResourceIdentifier(mapdefinition).Name
Dim rtMapId as String = new ResourceIdentifier(mapName,
ResourceTypes.RuntimeMap, conn.SessionID)
'Load the runtime map
Dim rtMap as RuntimeClasses.RuntimeMap = conn.GetRuntimeMap(rtMapId)
Dim rtLayer as RuntimeClasses.RuntimeMapLayer = rtMap.Layers(layername)
'Get the current layer and assing the filter
Dim layerDefinition as LayerDefinition =
conn.GetLayerDefinition(rtLayer.ResourceId)
Dim vectorLayerDefinition as VectorLayerDefinitionType =
layerDefinition.Item
vectorLayerDefinition.Filter = newFilter
'Save a copy of the layer, temporary, and random name
rtLayer.ResourceID = new ResourceIdentifier(Guid.NewGuid().ToString(),
ResourceTypes.LayerDefinition, conn.SessionID)
conn.SaveResourceAs(layerDefinition, rtLayer)
'Save the runtime map, pointing to the updated layerdefinition
conn.SaveRuntimeMap(rtMapId, rtMap)
'Tell the client to refresh
RegisterStartupScript("key", "<script>GetMapFrame().Refresh();</script>")
but my problem is that
1) I dont know where to and how to start the code
i had only main.aspx page which contains the following code
%@ Page language="c#" %>
<%@ Import Namespace="System.IO" %>
<%@ Import Namespace="System.Collections.Specialized" %>
<%@ Import Namespace="System.Text" %>
<%@ Import Namespace="System.Globalization" %>
<%@ Import Namespace="OSGeo.MapGuide" %>
<script runat="server">
String webLayout = "Library://Filesample/layout/weblay.WebLayout";
String sessionId = "";
</script>
<%
try
{
// Initialize a session and register a variable to hold the
// session id, then initialize the Web Extensions, connect
// to the site, and create a session.
// Initialize Web Server Extensions.
String realPath = Request.ServerVariables["APPL_PHYSICAL_PATH"];
String configPath = realPath + "..\\webconfig.ini";
MapGuideApi.MgInitializeWebTier(configPath);
// Connect to the site.
MgUserInformation userInfo = new MgUserInformation("Anonymous", "");
MgSite site = new MgSite();
site.Open(userInfo);
// Create a session
sessionId = site.CreateSession();
}
catch (Exception e)
{
Response.Write(e.Message);
}
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>MapGuide Developer's Guide ASP.NET Samples</title>
</script>
</head>
<frameset rows="110,*" frameborder="no" framespacing="0">
<frame id="titleFrame" frameborder="no" marginwidth="0" marginheight="0"
scrolling="no" src="title.html">
<frame id="viewerFrame" frameborder="no" marginwidth="0" marginheight="0"
scrolling="no"
src="../mapviewernet/ajaxviewer.aspx?SESSION=<%=sessionId%>&WEBLAYOUT=<%=webLayout%>">
</frameset>
</html>
In my weblayout there is 2 layers (polgon layer and line layer)
i looked at the code for dotnetsmples but i totally confused with that code.
can u plz tell me how to and where i can write the code for layer editing
Thanks and Regards,
Padmini.
--
View this message in context: http://www.nabble.com/Problem-with-Layer-Editing-tp20918365p20918365.html
Sent from the MapGuide Users mailing list archive at Nabble.com.
More information about the mapguide-users
mailing list