[mapguide-users] Error: Unable to Make Permanent Changes to Map

Robert Bray rbray at robertbray.net
Mon Feb 26 01:17:14 EST 2007


Jim,

At this point there is no way to save an MgMap object to the Library 
repository. I personally think there is a strong use case for this, so I 
encourage you to go to this link (http://trac.osgeo.org/mapguide) and 
add an enhancement request for this feature. Read the page on submitting 
defects and enhancements, then use the "New Ticket" link.

In the meantime the only way to do this is to save the changes in "per 
user" Map Definition resources or by recording the "per user" MgMap 
changes in an external file or database. On application load you'll then 
need to detect the presence of the per user information and take the 
appropriate action to initialize the map before the user sees it for the 
first time.

Sorry I don't have a better answer...

Bob

Jim O'Leary wrote:
> Has there been an answer to this question? Can you save a runtime map to the
> repository?
> 
> I have a map to which a user can add a new layer to a given layer group
> using the browser. My program can save the new layer to the repository using
> SetResource(), and can add it to the given layer group in the runtime map.
> Is there a way to programmatically save the runtime map with the new layer
> to the repository?
> 
> Thanks
> 
> 
> 
> Robert Bray-2 wrote:
>> Stephen,
>>
>> There are two distinctly different object types at play here and I 
>> suspect you might be confusing them. MapGuide Studio creates what we 
>> refer to as a MapDefintion. It is defined by an XML document and 
>> primarily contains a coordinate system, extent, background color, and 
>> layer and group lists.
>>
>> The MgMap object represents something slightly different.  MgMap 
>> represents an instance or run time representation of a MapDefinition. 
>> Each client through the viewer has it's own copy of an MgMap that is 
>> usually stored in a session. I'll have to check, but I am not sure an 
>> MgMap can be saved to the Library repository (that is the software may 
>> prevent them from being saved in Library://). Like I said I'll need to 
>> check on that.
>>
>> Assuming it is allowed, the problem below may be because you are trying 
>> to save an MgMap using a resource identifier with type 'MapDefinition'. 
>> Before you go any further however, you should think about whether you 
>> are really trying to create an MgMap or a MapDefinition.
>>
>> Hope this helps...
>> Bob
>>
>> Stephen Park wrote:
>>> I am unable to save a map permanently to the repository when the map has
>>> been opened via the MgMap.Create(.) API. I have seen 2 or 3 back-posts
>>> about
>>> this issue but no resolution. Could use some insite. 
>>>
>>> Win2k3 Server
>>> MGOS 1.0.1
>>> MapGuideDotNetApi
>>>
>>> Repro: 
>>> Open an  existing map via MgMap.Create(.) API 
>>> 	//Resource Id is of form Library://./MyMap.MapDefinition
>>> Add layer created previously via Studio 2K7 R1 to the map 
>>> 	MgMap.GetLayers().Add(newLayer);
>>> Save the Map back to the repository: 
>>> 	MgMap.Save(_resourceService, resourceId); 
>>> 		**Exception Here**
>>>
>>> If I use the .Save method that accepts a single argument (resource
>>> service)
>>> I get a null reference exception. Adding the same layer to the same map
>>> via
>>> MapGuide Studio works correctly. Any hints?
>>>
>>> Exception Information: 
>>>
>>> OSGeo.MapGuide.MgXmlParserException: An exception occurred in the XML
>>> parser.
>>> - MgResourceServiceHandler.ProcessOperation line 80 file
>>> c:\build_tux_area\mgdev_opensource\server\src\services\resource\ResourceServ
>>> iceHandler.cpp
>>> - MgOpSetResource.Execute line 109 file
>>> c:\build_tux_area\mgdev_opensource\server\src\services\resource\OpSetResourc
>>> e.cpp
>>> - MgServerResourceService.SetResource line 712 file
>>> c:\build_tux_area\mgdev_opensource\server\src\services\resource\ServerResour
>>> ceService.cpp
>>> - MgRepositoryManager.SetResource line 867 file
>>> c:\build_tux_area\mgdev_opensource\server\src\services\resource\RepositoryMa
>>> nager.cpp
>>> - MgRepositoryManager.UpdateResource line 1004 file
>>> c:\build_tux_area\mgdev_opensource\server\src\services\resource\RepositoryMa
>>> nager.cpp
>>> - MgResourceDefinitionManager.UpdateResource line 261 file
>>> c:\build_tux_area\mgdev_opensource\server\src\services\resource\ResourceDefi
>>> nitionManager.cpp
>>> - MgResourceContentManager.UpdateDocument line 647 file
>>> c:\build_tux_area\mgdev_opensource\server\src\services\resource\ResourceCont
>>> entManager.cpp
>>> - MgResourceDefinitionManager.UpdateDocument line 601 file
>>> c:\build_tux_area\mgdev_opensource\server\src\services\resource\ResourceDefi
>>> nitionManager.cpp
>>> - MgResourceDefinitionManager.ValidateDocument line 429 file
>>> c:\build_tux_area\mgdev_opensource\server\src\services\resource\ResourceDefi
>>> nitionManager.cpp
>>> - MgResourceContentManager.ValidateDocument line 536 file
>>> c:\build_tux_area\mgdev_opensource\server\src\services\resource\ResourceCont
>>> entManager.cpp
>>>
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>
>>
>>
> 


More information about the mapguide-users mailing list