[mapguide-internals] Session-MapName-Map
Haris Kurtagic
haris at sl-king.com
Fri Aug 31 13:40:23 EDT 2007
Thank you, you are right on the track.
Yes, you could change name as you suggested or use different sesion for
every map or ...
I would prefer to have a in server solution for this (and to be able to
work with multiple maps in one session).
Perhaps server could return DataKey from DB after creating new Map in
it?
Haris
-----Original Message-----
From: mapguide-internals-bounces at lists.osgeo.org
[mailto:mapguide-internals-bounces at lists.osgeo.org] On Behalf Of Paul
Spencer
Sent: Friday, August 31, 2007 7:23 PM
To: MapGuide Internals Mail List
Subject: Re: [mapguide-internals] Session-MapName-Map
Haris,
I'm not sure if I really know what I am talking about here, but my
understanding is that when you start up a session with a
MapDefinition, you can save the runtime MgMap object to the session
repository as a Map resource and give it a name at that time. The
name is arbitrary, but in the case of the AJAX viewer it is
predictable from the MapDefinition name and I think you are right
that it would either blow away the existing Map or conflict in some way.
I'm not sure how the existing viewer works, but it doesn't contain
the capability to change maps at run time so it would never run into
this issue. In Fusion, we can load different MapDefinitions at run
time and we do something like this when the user wants to load the map:
/* $mapid is a string resource id Library://... */
$resourceID = new MgResourceIdentifier($mapid);
$map = new MgMap();
$mapName = $resourceID->GetName();
$map->Create($resourceService, $resourceID, $mapName);
$mapStateId = new MgResourceIdentifier("Session:" . $sessionID .
"//" . $map->GetName() . "." . MgResourceType::Map);
$map->Save($resourceService, $mapStateId);
(NB: there is a potential problem here if the map name is the same as
one already in the session. I will need to fix this potential bug in
Fusion - I will probably use an md5 hash of the string version of the
full Library:// path to the original map. This would probably look
like:
$mapName = md5($mapid);
and the rest of the code would look the same.
)
We return the $mapName to the client so that subsequent requests can
operate on the the appropriate Map object on the server side using
something like this:
$map = new MgMap();
$map->Open($resourceService, $mapName);
The mapagent rendering operations take the session id and the map
name to render map images and dynamic map overlays.
Does that help?
Cheers
Paul
On 31-Aug-07, at 1:05 PM, Haris Kurtagic wrote:
> I would appreciate if someone could help me to clarify
> Session-MapName-Map interaction.
>
>
>
> Now how MG Viewer-Server is working is that it will create new
> session
> and read web layout and create a runtime map in session repository.
>
> Later runtime map is accessed by name (only name part of it) from the
> session repository.
>
> So, if I would have two Maps created in Library in separate folders
> with
> same name and if I would add the second map to session repository I
> could not access both Maps ( because Session Id and MapName are
> used to
> identify it - and they are same).
>
>
>
> Am I right about this ?
>
>
>
> Thanks,
>
> Haris
>
> _______________________________________________
> mapguide-internals mailing list
> mapguide-internals at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapguide-internals
+-----------------------------------------------------------------+
|Paul Spencer pspencer at dmsolutions.ca |
+-----------------------------------------------------------------+
|Chief Technology Officer |
|DM Solutions Group Inc http://www.dmsolutions.ca/ |
+-----------------------------------------------------------------+
_______________________________________________
mapguide-internals mailing list
mapguide-internals at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapguide-internals
More information about the mapguide-internals
mailing list