Infrastructure Map Server Forum
Welcome to Autodesk’s Infrastructure Map Server Forums. Share your knowledge, ask questions, and explore popular Infrastructure Map Server topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Problems opening a map

5 REPLIES 5
Reply
Message 1 of 6
wcrichton
651 Views, 5 Replies

Problems opening a map

Greetings,

I am working with MGE in an ASP development environment.

Everything was going fine (except for the lack of documentation for ASP, C# or VB)
I started by modifying some of the sample code to work with my own data.
I got things up and running but then...

I started to get an error when attempting to open a map object.
The error started out inconsistent, sometimes my page opened fine, other times it failed.
Then it became consistent and would fail every time.
I added a loop to attempt to open the map 1000 tries.
I still hit the error on every attempt.
Then I added in one more additional attempt and the map would open...!

Nasty...

Code sample is attached

Anyone out there working on the bleeding edge with me?

Cheers,
Will Crichton
5 REPLIES 5
Message 2 of 6
Anonymous
in reply to: wcrichton

wcrichton wrote:
> I added a loop to a
> ttempt to open the map 1000 tries.
> I still hit the error on every attempt.


I don't think it actually failed 1000 times.

You might want to modify this block:

try
{
map.Open(resourceService, "Composite");
IsMapOpen = true;
}

to this:

try
{
map.Open(resourceService, "Composite");
IsMapOpen = true;
KeepTrying = false;
}

Jason
Message 3 of 6
ales6
in reply to: wcrichton

I have the same problem. I did see that you can connect two ways by session id or username and password:

// this one does not work
MgUserInformation userInfo = new MgUserInformation(sessionID);

// this works
MgUserInformation userInfo = new MgUserInformation(username, password);

siteConnection = new MgSiteConnection();
siteConnection.Open(userInfo);

if site connected I try to:

MgResourceService resService = (MgResourceService)siteConnection.CreateService(MgServiceType.ResourceService);
MgLayerBase tmpLayer = null;
MgMap map = new MgMap();
// I get error
map.Open(resService, "Sheboygan");

Error description:

Invalid argument(s): [0] = " " The string cannot be empty.Invalid argument(s): [0] = " " The string cannot be empty. Exception occurred in method MgMap.Open at line 444 in file c:\build_bond_area\bond_nightly\build_41.3\ent\os\common\mapguidecommon\MapLayer/Map.cpp

Can anyone help please ?
Message 4 of 6
santosh.venkatesh
in reply to: ales6

Hey I am facing a similar issue that you had faced a while ago

Have you got a solution to the issuwe below

Message 5 of 6
gluckett
in reply to: ales6

You are creating a new MgMap() but not giving it a name or path:

map.Create(resService, new MgResourceIdentifier(“Library://Samples/Sheboygan/Maps/Sheboygan.MapDefinition”), “Sheboygan”);
map.Save();

then you can
map.Open(resService, "Sheboygan");
Message 6 of 6

Hi,

 Thank you for your reply But I have already created a map session and my map has loaded from the XML

MgSiteConnection siteConnection = new MgSiteConnection();
            siteConnection = CreateMGSession(gszMGUser, gszMGPass, gszWebConfig);
            string szSessionId = siteConnection.GetSite().CreateSession();

            Session["Session"] = szSessionId;
            MgResourceService resSvc = default(MgResourceService);
            resSvc = (MgResourceService)siteConnection.CreateService(MgServiceType.ResourceService);

 Now I want to reopen to connection to get the selected feature from the map (Selection using the mouse)

 

if (Session["Session"] == null)
            return;
        String mgSessionId = Session["Session"].ToString();
        String mgMapName = "map";

        String configPath = ConfigurationManager.AppSettings["WebConfigPath"];
        MapGuideApi.MgInitializeWebTier(configPath);
        MgUserInformation userInfo = new MgUserInformation(mgSessionId);
        MgSiteConnection siteConnection = new MgSiteConnection();
        siteConnection.Open(userInfo);

  Here when opening the connection again using the same sessionid earlier created throws me an error "Session has expired or is invalid. Please log in again." 


This error is thrown when I use AIMS 2014 but works fine with MapGuide 2011

 

Am missing something here

Please guide..

 

Tags (1)

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums