<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
The sessionId can be read from the map, using javascript.<br>
Refer to the MapGuide Viewer API:<br>
<a class="moz-txt-link-freetext" href="file:///C:/Program">file:///C:/Program</a>
Files/MapGuideOpenSource2.0/WebServerExtensions/Help/viewerapi.html<br>
<br>
The MapDefinition is the name of the map used, you must supply this
manually.<br>
You may also read it from the WebLayout, or possibly use the javascript
GetMapName() to read the RuntimeMap ResourceId.<br>
(In the latter case, you can skip the code that converts the
MapDefinition ResourceId to the RuntimeMap ResourceId).<br>
<br>
The Layername is the name of the layer on which you wish to modify the
filter.<br>
The NewFilter is the filter to use on the layer, eg. "ID > 10 AND ID
< 100".<br>
These two parameters are likely something you will set manually.<br>
<br>
<pre class="moz-signature" cols="72">Regards, Kenneth Skovhede, GEOGRAF A/S
</pre>
<br>
<br>
padmini godavarthi skrev:
<blockquote cite="mid:20899278.post@talk.nabble.com" type="cite">
<pre wrap="">Hi,
Thanks
In ur code
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")
1) from where it will come.i mean Request.Params("SESSIONID") ,
Request.Params("MAPDEFINITION") ,Request.Params("LAYERNAME") ,
Request.Params("NEWFILTER") all these things
Regards,
Padmini
Kenneth Skovhede, GEOGRAF A/S wrote:
</pre>
<blockquote type="cite">
<pre wrap="">You need to call the aspx page with the session id, either as a
querystring or as a post.
'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(<a class="moz-txt-link-rfc2396E" href="http://myserver/mapguide/mapagent/mapagent.fcgi">"http://myserver/mapguide/mapagent/mapagent.fcgi"</a>)
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>")
Regards, Kenneth Skovhede, GEOGRAF A/S
padmini godavarthi skrev:
</pre>
<blockquote type="cite">
<pre wrap="">Hi
iam using Mapguide opensource 2.0(with .net 2.0 +IIS 5.1)
Hi, We want modify dynamically a layer; for exemple, modify the filter of
a
layer when the map is loaded;Is it possible ? What is the method : using
an
API ?
can u give me the sample code in .net so that it will be very helpful to
me
Regards,
Padmini.
</pre>
</blockquote>
<pre wrap="">_______________________________________________
mapguide-users mailing list
<a class="moz-txt-link-abbreviated" href="mailto:mapguide-users@lists.osgeo.org">mapguide-users@lists.osgeo.org</a>
<a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/mapguide-users">http://lists.osgeo.org/mailman/listinfo/mapguide-users</a>
</pre>
</blockquote>
<pre wrap=""><!---->
</pre>
</blockquote>
</body>
</html>