[mapguide-users] Re: Add Mapguide layer to OpenLayers

Greg gbneff at cid.utah.gov
Thu Oct 6 13:16:30 EDT 2011


Thanks very much for the response.  I have tried this many different ways and
always get error 559 (MgResourceNotFoundException) 

I think these are the relevant lines of my code (there are no errors when
this code runs, only when OpenLayers tries to find the map):

        /MapGuideApi.MgInitializeWebTier(configPath);
        MgUserInformation userinfo = new
OSGeo.MapGuide.MgUserInformation(defaultUser, defaultPassword);
        MgSite site = new MgSite();
        site.Open(userinfo);
        sessionId = site.CreateSession();
        
        MgUserInformation userInfo = new MgUserInformation(sessionId);
        MgSiteConnection siteConnection = new MgSiteConnection();
        siteConnection.Open(userInfo);
        
        MgResourceService resService =      
(MgResourceService)siteConnection.CreateService(MgServiceType.ResourceService);
        MgResourceIdentifier mapDefId = new MgResourceIdentifier(mapDef);
        MgMap map = new MgMap();
        mapName= mapDefId.GetName();
        map.Create(resService, mapDefId, mapName);
        MgResourceIdentifier mapId = new MgResourceIdentifier("Session:" +
sessionId + "//" + map.GetName() + "." + MgResourceType.Map);
        map.Save(resService, mapId);
        mapName = map.GetName();/

I pass mapName and sessionId to OpenLayers and attempt to create a Mapguide
overlay layer.

>From everything I have found on-line this should work so I am at a loss
here.  Any help is appreciated.

Greg

--
View this message in context: http://osgeo-org.1803224.n2.nabble.com/Add-Mapguide-layer-to-OpenLayers-tp6841213p6866660.html
Sent from the MapGuide Users mailing list archive at Nabble.com.


More information about the mapguide-users mailing list