[mapguide-users] Saving map to session doesn't persist?

Chris Gountanis cgountanis at mpower-tech.com
Fri Nov 17 16:57:37 EST 2006


I am totally with that idea. Need more real code examples on the actual
MapGuide API itself as if there was never a viewer included.


--
Chris Gountanis
Programmer/Analyst - Network Administrator
cgountanis at mpower-tech.com
T: 877-269-6971 | T: 920-830-4053 | F: 920-832-0736

MPOWER TECHNOLOGIES
501 S Nicolet Road Appleton, WI 54914
www.mpower-tech.com

Making complex information more accessible.


-----Original Message-----
From: Jason Birch [mailto:Jason.Birch at nanaimo.ca] 
Sent: Friday, November 17, 2006 3:42 PM
To: users at mapguide.osgeo.org
Subject: RE: [mapguide-users] Saving map to session doesn't persist?

Ok, now you've got me going around in circles, but I think it's working now
(script attached) :)

- I need to save the MgMap as an MgResourceType::Map

- For the GETMAPIMAGE mapagent operation, it appears that the MAPDEFINITION
parameter is not used if the MAPNAME and SESSION variables are set.  This
caused me a fair amount of confusion.

- I added the lines that Chris suggested earlier between the map->Create and
the map->Save :

    //create an empty selection object and store it in the session
repository
    $sel = new MgSelection($map);
    $sel->Save($resourceService, 'Sheboygan');

I'm thinking that this whole issue may be in the way that the MapAgent
GETMAPIMAGE operation works.  It doesn't appear that there is any way to
call the MgRenderingService->RenderMap() without an MgSelection, so I'm
guessing that the MapAgent is expecting the map in the session repository to
have a Selection associated with it.  If this is the case, it would be nicer
if the MapAgent just created a null selection if there wasn't one there.

As an aside, I could REALLY use an example of how to use the
RenderingService in PHP instead of having to waste cycles passing the map
through the repository.  The php viewer sample utilityfunctions.php has a
function called OutputReaderContent which should help, but I have a few
questions about how to do DPI / width calculations (are the width and height
in RenderMap in map units?) and a couple other things.

Jason
 

-----Original Message-----
From: Paul Spencer [mailto:pspencer at dmsolutions.ca]
Sent: Friday, November 17, 2006 11:30
To: users at mapguide.osgeo.org
Subject: Re: [mapguide-users] Saving map to session doesn't persist?

Jason, in your $map->Save use MgResourceType::Map

Cheers

Paul

On 17-Nov-06, at 1:22 PM, Jason Birch wrote:

> This is what the code looks like now:
>
>     //Set up the map to be used in this service
>     $resourceID = new
> MgResourceIdentifier('Library://Samples/Sheboygan/Maps/
> Sheboygan.MapDefi
> nition');
>
>     //Create a connection to the map
>     $map = new MgMap();
>     $map->Create($resourceService,$resourceID,'Sheboygan');
>
>     //Save the map into the repository
>     $mapId = new MgResourceIdentifier("Session:$sessionId//
> Sheboygan.".
> MgResourceType::MapDefinition);
>     $map->Save($resourceService, $mapId);
>
> Now I'm getting the following error on the MgMap->Save :
>
> Error: An exception occurred in the XML parser.
> Details:An exception occurred in the XML parser. Exception occurred in

> method MgResourceContentManager.ValidateDocument at line 586 in file 
> c:\build_tux_area\mgdev\server\src\services\resource
> \ResourceContentMana
> ger.cpp
>
> ???
>
> Is it possible that the MapDefinition in the Sheboygan sample is not 
> valid?  But then it would have errored on the Load in Administrator.
>
> Jason
>
>
> -----Original Message-----
> From: Tom Fukushima [mailto:tom.fukushima at autodesk.com]
> Sent: Friday, November 17, 2006 09:26
> To: users at mapguide.osgeo.org
> Subject: RE: [mapguide-users] Saving map to session doesn't persist?
>
> Hi Jason,
>
> Where you are using MgResourceType::Map, try using 
> MgResourceType::MapDefinition instead.
>
> Hope this solves the problem,
> Tom
>
> -----Original Message-----
> From: Jason Birch [mailto:Jason.Birch at nanaimo.ca]
> Sent: Friday, November 17, 2006 10:08 AM
> To: users at mapguide.osgeo.org
> Subject: [mapguide-users] Saving map to session doesn't persist?
>
> I've attached an example that I think should save a MapDefinition to 
> the session repository, but a call to MapAgent to render the map comes

> up with a MgResourceNotFoundException (I think).
>
> Is there something that says that MapDefinitions need to be modified 
> to be persisted?  Is there a typo in there somewhere?
>
> Jason
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe at mapguide.osgeo.org
> For additional commands, e-mail: users-help at mapguide.osgeo.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe at mapguide.osgeo.org
> For additional commands, e-mail: users-help at mapguide.osgeo.org
>

+-----------------------------------------------------------------+
|Paul Spencer                          pspencer at dmsolutions.ca    |
+-----------------------------------------------------------------+
|Chief Technology Officer                                         |
|DM Solutions Group Inc                http://www.dmsolutions.ca/ |
+-----------------------------------------------------------------+





---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe at mapguide.osgeo.org
For additional commands, e-mail: users-help at mapguide.osgeo.org






More information about the Mapguide-users mailing list