[mapguide-users] Adding a dynamic layer BEFORE displaying the map

Kenneth, GEOGRAF A/S ks at geograf.dk
Mon Jan 21 03:39:34 EST 2008

If you want to add it before the map loads, there is no session.
This happens because the MapGuide AJAX viewer creates the session and 
the runtime map.

You have to create the LayerDefinition and the MapDefinition in the 
Library repository.
My best solution for this is to create a folder like "Libray://Temp".
Then create a GUID for each resource, and dump it here.
After the AJAX viewer loads, you may delete the created items, as it 
then uses the RuntimeMap in the session repository.

Regards, Kenneth, GEOGRAF A/S

uXuf skrev:
> Its just a copy of the parcelmarker.xml from the samples. It works otherwise
> with tasks, but I couldn't seem to get it work before the map is loaded.
> uXuf
> Jackie Ng wrote:
>> What does the feature source xml look like? It seems that feature source
>> xml is an invalid document.
>> - Jackie
>> uXuf wrote:
>>> Hi all,
>>> I am trying to add a dynamic layer to a map but before loading the map in
>>> the map frame. It is supposed to work on some query string parameters and
>>> should add a dynamic layer based on that information. I can add the Map
>>> to the session. I want to query the map from the Session Repository and
>>> work on a copy, however I keep getting the
>>> Session:xxxx//PointPlotter.FeatureSource Exception occurred in method
>>> MgResourceDefinitionManager.GetDocument at line 476 in file
>>> c:\build_bond_area\mapguide_open_source_v1.2\build_18.1\mgdev\server\src\services\resource\ResourceDefinitionManager.cpp 
>>> error.
>>> Here is how I constructed the logic:
>>> 1- Make a new MgSite object
>>> 2- Use MgSite->Open with a new MgUserInformation object
>>> 3- store the session ID in a variable
>>> 4- Check GET parameters
>>> 5- if records exists depending on the GET parameters, make a new
>>> MgSiteConnection object
>>> 6- Open this MgSiteConnection object with the session ID
>>> 7- Create a ResourceService by using MgSiteConnection->CreateService
>>> 8- Open the map by using $map->Open($resourceService, 'MapName') (EDIT: I
>>> used the $map->Create() function)
>>> 9- Verify and add layers (building upon the Sheboygan Find Parcel example
>>> from MG 1.1 samples)
>>> Do I need to explicity add a feature source to the session repository?
>>> But I think that's what exactly the CreatePointPlotterFeatureSource
>>> function does from the findparcelsfunctions.php does in the samples.
>>> And this error occurs when I call the CreatePointPlotterFeatureSource
>>> function. When I add a new FeatureSource in the form of
>>> MgResourceIdentifier it works fine (i.e. no errors generated), but on the
>>> first call to the above-mentioned function it crashes. Apparently it
>>> doesn't execute even the first line which I changed into an "echo" for
>>> debugging purposes.
>>> Anybody got any tips?
>>> Regards,
>>> uXuf
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/mapguide-users/attachments/20080121/3e898d58/attachment.html

More information about the mapguide-users mailing list