[mapguide-users] eplot from winform

Kenneth ks at geograf.dk
Mon May 7 08:02:41 EDT 2007


You should fully qualify the name of the map, eg:

Library://Folder/Map.MapDefinition

And use that with the ResourceIdentifier, and ResourceService.Open.

The map.Open() that you are using is a wrapper that allows reading a map 
from the session repository. As you do not have such a map, it won't 
work (you create a new session, that is per default empty).

Beware also that the session map is not the same as the MapDefinition 
(it may have been changed), and the viewer does not store current zoom 
and other properties in this session map. Also, the session map is not 
stored in Xml, but an internal binary format.

-- 
Regards, Kenneth, GEOGRAF A/S



alucas wrote:
> Hi all,
>
> I want to connect from my winform to mapguide server to get an EPlot. The
> first test is a simple test connection winform client like this.
>
> private void Connect_Click(object sender, EventArgs e)
>         {
>             try
>             {
>                 MapGuideApi.MgInitializeWebTier("webconfig.ini");
>                 MgUserInformation ui = new MgUserInformation("Anonymous",
> "");
>                 MgSiteConnection siteconn = new MgSiteConnection();
>                 siteconn.Open(ui);
>                 MgResourceService resourceService =
> (MgResourceService)siteconn.CreateService(MgServiceType.ResourceService);
>                 MgMappingService mappingService =
> (MgMappingService)siteconn.CreateService(MgServiceType.MappingService);
>                 MgMap map = new MgMap();
>                 map.Open(resourceService, "map");
>             }
>             catch (Exception ex)
>             {
>                 MessageBox.Show(ex.ToString());
>             }
>
> I've added a reference to MapGuideDotNetApi.dll in the project and put all
> dll's necessary in the directory. So, I get this error:
>
> - MG 1.1.0 : Invalid argument in map.Open(resourceService, "map"); // the
> map name is correct! it seems that the map name is an empty string
>
>   




More information about the mapguide-users mailing list