[mapguide-users] Bypassing initial view at startup - and adding a layer

Kenneth Skovhede, GEOGRAF A/S ks at geograf.dk
Thu Sep 4 08:01:13 EDT 2008


The map->Create() should return the runtime map.
However, when you start the viewer, it also calls map->Create() and 
destroys your adjusted runtime map.
So, you must do:

1. Load MapDefinition from Library
2. Insert the polygon layer into the Xml
3. Save the MapDefinition to Session
4. Load WebLayout from Library
5. Modify WebLayout to use Session-based MapDefinition (from step 3)
6. Save WebLayout to Session
7. Redirect to Session-based WebLayout (from step 6)

You can combine step 5 with your overriden zoom function.
You might want to examine the MapDefinition xml to see how the layer 
information looks (step 1).

The runtime map is a binary chunk, not an xml document.
(Actually it is a ResourceData file appended to an empty xml document)

Regards, Kenneth Skovhede, GEOGRAF A/S



gingerbbm skrev:
> Kenneth Skovhede, GEOGRAF A/S wrote:
>   
>> You must add your layer to the MapDefinition in step 1.
>>
>>     
>
> OK. I changed my code to do a $map->Create() based upon the Library Map
> Definition, whereupon I create the polygon and layer and add it successfully
> to $map.
>
> I save that to an MgResourceIdentifier derived from
> "Session:$sessionId//$mapName.Map".
>
> Then what I try and do is GetResourceContent() on that MgResourceIdentifier
> to load as XML. Then I create a new MgResourceIdentifier derived from
> "Session:$sessionId//$sessionMdName.MapDefinition", and when I call
> SetResource() against that the script breaks.
>
> I suspect that something is going wrong before that though, because the
> script also breaks if I try and echo the variable populated by the saveXML()
> method.
>
>   
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapguide-users/attachments/20080904/a69f2ca9/attachment.html


More information about the mapguide-users mailing list