[mapguide-users] .NET Basic Example Issues (Hello World?)

Kenneth Skovhede, GEOGRAF A/S ks at geograf.dk
Tue Nov 3 03:19:19 EST 2009


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 at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapguide-users
>   


More information about the mapguide-users mailing list