[mapguide-users] modifying map before the WebLayout loads

Kenneth, GEOGRAF A/S ks at geograf.dk
Fri Jul 20 06:07:46 EDT 2007


I realise that the supplied code is just a snip of the actual code, but 
the overal procedure should be:
Create session
Load MapDefinition
Modify MapDefinition as needed
Save MapDefinition in session repo
Load WebLayout
Modify WebLayout to point to session map
Save WebLayout in session repo
Open viewer pointing to WebLayout in Session repo

If you modify any layers, you must also save those to the session repo, 
and update the MapDefintion to point to those.

Below I think you are saving a runtime map, rather than the MapDefinition.
I belive the viewer will overwrite any existing runtime maps.

Regards, Kenneth, GEOGRAF A/S




David Hequet skrev:
> Hi,
>
> I'm using Mapguide Enterprise 2008 / MGOS1.2 and i can't solve this:
>
> I have a frame containing mapguide viewer.
> This frame performs VB.net scripts that initialize the Session and
> eventually modify the mapdefinition (setting filter's on layer..)
>
> I can Access the map before the WebLayout Load process like this: (assuming
> that sessionId and resourceService are well intialized)
>
> Dim aMap As New MgMap()
> dim aMapname as String = "MyMapName"
>
> resId = New MgResourceIdentifier(aMapLibraryPath & aMapname & "." &
> MgResourceType.MapDefinition)
> aMap.Create(resourceService, resId, aMapname)
> Dim mapStateId As MgResourceIdentifier = New MgResourceIdentifier("Session:"
> + sessionId + "//" + aMapname + "." + MgResourceType.Map)
> aMap.Save(resourceService, mapStateId)
>
> It actually work, i access the MgMap Object, can perform modification. But
> when the the layout loads after these modification (via
> "http://localhost/mapguide/mapviewerajax/?Session=" + sessionId +
> "&WebLayout=Library://myLayout.WebLayout&LOCALE=fr" on my frame) it seems to
> re-initialize the MapDefinition :
> If i access it and ask about my modified Filters, there back to original
> value..
> I'm almost sure this code was good working using Mapguide 2007 / MGOS 1.0.
>
> Does the WebLayout Load process changed?
> I you have an idea that can help me..
>   


More information about the mapguide-users mailing list