[mapguide-users] Error when instantiating a Map via MgMap.Open() method

Maksim Sestic max at geoinova.com
Thu Oct 11 10:48:46 EDT 2007


My oh my, I would have never guessed it... :-) Works fine now, thanks Jackie.
My first though was that MgMap.Create() method actually creates new MgMap.

Regards,
Maksim Sestic


Jackie Ng wrote:
> 
> Open() is for opening a runtime map. This is usually a map from an already
> initialized weblayout.
> 
> If you are trying to instantiate maps outside of the ajax viewer, you
> should be using the Create() method instead.
> 
> - Jackie
> 
> 
> 
> Maksim Sestic wrote:
>> 
>> Hi all,
>> 
>> It's about MGE 2008 and instantiating MpMap type via MgMap.Open() method.
>> It throws an exception saying that "Resource was not found". I tried
>> various types of parameters on overloaded Open method and none of them
>> worked, throwing the same exception. Necessary connection and services
>> were instantiated just fine. It always dies at the MgMap.Open(...) line:
>> 
>> (Method 1 - via Library ResourceIdentifier)
>> Dim svc As MgResourceService = CType(Me.SiteConnection.CreateService(0),
>> MgResourceService)
>> Dim m As MgMap = New MgMap()
>> Dim id As String = "Library://...(path to my map)..."
>> Dim resId As MgResourceIdentifier = New MgResourceIdentifier(id)
>> m.Open(svc, id)
>> 
>> (Method 2 - via Map name)
>> Dim svc As MgResourceService = CType(Me.SiteConnection.CreateService(0),
>> MgResourceService)
>> Dim m As MgMap = New MgMap()
>> m.Open(svc, "NameOfMyMap")
>> 
>> (Method 3 - via Session + Map name)
>> Dim site As MgSite = New MgSite
>> site.Open(Me.UserInformation)
>> dim sessionId As String = site.CreateSession
>> Dim svc As MgResourceService = CType(Me.SiteConnection.CreateService(0),
>> MgResourceService)
>> Dim id As String = "Session:"+sessionId+"//NameOfMyMap"
>> Dim resId As MgResourceIdentifier = New MgResourceIdentifier(id)
>> m.Open(svc, id)
>> 
>> and few other methods but none of them worked :-)
>> 
>> Is there any help to this?
>> 
>> Regards,
>> Maksim Sestic
>> 
>> 
> 
> 

-- 
View this message in context: http://www.nabble.com/Error-when-instantiating-a-Map-via-MgMap.Open%28%29-method-tf4606044s16610.html#a13157451
Sent from the MapGuide Users mailing list archive at Nabble.com.



More information about the mapguide-users mailing list