That worked thanks! Here is a great exanple to help others that are not using the viewer which must do this for you.
public string DoMapGuide() { string mapName = "Sheboygan"; string resourceLocation = "Library://Samples/Sheboygan/Maps/Sheboygan.MapDefinition"; string webConfig = "C:\\Program Files (x86)\\OSGeo\\MapGuide\\Web\\www\\webconfig.ini"; string userName = "Anonymous"; string userPassword = ""; MapGuideApi.MgInitializeWebTier(webConfig); MgUserInformation userInfo = new MgUserInformation(userName, userPassword); MgSite site = new MgSite(); site.Open(userInfo); String mgSessionId = site.CreateSession(); MgUserInformation userInfoSession = new MgUserInformation(mgSessionId); MgSiteConnection siteConnection = new MgSiteConnection(); siteConnection.Open(userInfoSession); MgResourceIdentifier resourceId = new MgResourceIdentifier(resourceLocation); //create resource services MgResourceService resourceSrvc = (MgResourceService)siteConnection.CreateService(MgServiceType.ResourceService); MgMap map = new MgMap(); map.Create(resourceSrvc, resourceId, mapName); return mgSessionId; } On Tue, Nov 3, 2009 at 2:19 AM, Kenneth Skovhede, GEOGRAF A/S <k...@geograf.dk> wrote: > That is an odd issue. > > What happens is that you create a runtime map (MgMap.Create). > Internally that means that the MapDefinition xml is converted to a binary > format, known as a "runtime map". > > For some reason, you cannot pass the resource id for the runtime map to the > MgMap.Open or MgMap.Create call, > but must pass the map name. The method overload you are calling is not > documented (afaik). > > Instead, try calling: > map.Create(resourceSrvc, resourceId, "Sheboygan"); > > The calls are documented here: > http://mapguide.osgeo.net/files/mapguide/docs/webapi/da/df8/class_mg_map_ef5b2026a831d04c93a60b7ba2460082.html > http://mapguide.osgeo.net/files/mapguide/docs/webapi/da/df8/class_mg_map_50515a38c44c727f7caa214138cd075b.html#50515a38c44c727f7caa214138cd075b > > Be aware that the MapGuide viewer will not use a pre-created runtime map, > but always create (and overwrite) a runtime map. > > Regards, Kenneth Skovhede, GEOGRAF A/S > > > > Rock Beans skrev: >> >> I create a session then use session to create site connection. I then >> have issues with map.open(). I tried map name "Sheboygan" and I tried >> using a resource indentifier. What am I doing wrong? >> >> MapGuideApi.MgInitializeWebTier("C:\\Program Files >> (x86)\\OSGeo\\MapGuide\\Web\\www\\webconfig.ini"); >> MgUserInformation userInfo = new MgUserInformation("Anonymous", ""); >> MgSite site = new MgSite(); >> site.Open(userInfo); >> String mgSessionId = site.CreateSession(); >> >> >> MgUserInformation userInfoSession = new MgUserInformation(mgSessionId); >> MgSiteConnection siteConnection = new MgSiteConnection(); >> siteConnection.Open(userInfoSession); >> >> >> //MgResourceIdentifier resourceId = new >> >> MgResourceIdentifier("Library://Samples/Sheboygan/Maps/Sheboygan.MapDefinition"); >> >> >> //create resource services >> MgResourceService resourceSrvc = >> >> (MgResourceService)siteConnection.CreateService(MgServiceType.ResourceService); >> >> >> MgResourceIdentifier resourceId = new >> >> MgResourceIdentifier("Library://Samples/Sheboygan/Maps/Sheboygan.MapDefinition"); >> >> MgMap map = new MgMap(); >> map.Create(resourceId, mapName); >> map.Open(resourceSrvc, mapName)y >> _______________________________________________ >> mapguide-users mailing list >> mapguide-users@lists.osgeo.org >> http://lists.osgeo.org/mailman/listinfo/mapguide-users >> > > _______________________________________________ > mapguide-users mailing list > mapguide-users@lists.osgeo.org > http://lists.osgeo.org/mailman/listinfo/mapguide-users > _______________________________________________ mapguide-users mailing list mapguide-users@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/mapguide-users