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.

_______________________________________________
mapguide-users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/mapguide-users

Reply via email to