[mapguide-users] modifying map before the WebLayout loads

Kenneth, GEOGRAF A/S ks at geograf.dk
Sun Jul 22 11:54:08 EDT 2007


You can use the GetResource / SetResource to read/write the WebLayout.
It is an XML file, and the XSD for that file is present in the server 
directory.

Regards, Kenneth, GEOGRAF A/S




David Hequet skrev:
> hum ok, my code miss this:
>
> Load WebLayout
> Modify WebLayout to point to session map
> Save WebLayout in session repo
> Open viewer pointing to WebLayout in Session repo 
>
> Since there is no API to access WebLayout, i dont know how to acces/modify
> the Layout.
> Thank you!
>
>
> Kenneth, GEOGRAF A/S wrote:
>   
>> 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..
>>>   
>>>       
>> _______________________________________________
>> mapguide-users mailing list
>> mapguide-users at lists.osgeo.org
>> http://lists.osgeo.org/mailman/listinfo/mapguide-users
>>
>>
>>     
>
>   
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapguide-users/attachments/20070722/8757128b/attachment.html


More information about the mapguide-users mailing list