The sessionId can be read from the map, using javascript.
Refer to the MapGuide Viewer API:
file:///C:/Program
Files/MapGuideOpenSource2.0/WebServerExtensions/Help/viewerapi.html
The MapDefinition is the name of the map used, you must supply this
manually.
You may also read it from the WebLayout, or possibly use the javascript
GetMapName() to read the RuntimeMap ResourceId.
(In the latter case, you can skip the code that converts the
MapDefinition ResourceId to the RuntimeMap ResourceId).
The Layername is the name of the layer on which you wish to modify the
filter.
The NewFilter is the filter to use on the layer, eg. "ID > 10 AND ID < 100".
These two parameters are likely something you will set manually.
Regards, Kenneth Skovhede, GEOGRAF A/S
padmini godavarthi skrev:
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:
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("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>")
Regards, Kenneth Skovhede, GEOGRAF A/S
padmini godavarthi skrev:
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.
_______________________________________________
mapguide-users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/mapguide-users
_______________________________________________
mapguide-users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/mapguide-users