Question

I'm having some problems integrating MS MapPoint 2009 into my WinForms .Net 2.0 application in C#. I've added the ActiveX MapPoint control onto a form and have no problems getting it to display a maps and locations; my concern is the time it takes to load a map once it is created.

The tests on my development machine have shown the average load time to be between 3 and 5 seconds, during which the application is totally locked. While this isn't totally unacceptable, it's an awfully long time to lose control of the application. Also, because the GUI thread is locked, I cannot show a loading dialog or something to mask the load time.

The line that hangs is this: (where axMappointControl1 is the MapPoint control)

axMappointControl1.NewMap(MapPoint.GeoMapRegion.geoMapNorthAmerica);

I've tried executing the NewMap method on another thread but the GUI thread still ends up being blocked.

My questions are:

  • What can I do to speed up MapPoint when it loads?
  • Is there any way to load MapPoint so that it won't block the GUI thread?

Any help is greatly appreciated.

Was it helpful?

Solution

According to these threads at mapforums.com the slowness of ActiveX startup is well known and unavoidable (though the question of threading to help with GUI responsiveness is still open.

One thing suggested was to abandon the ActiveX version in favor of the MapPoint.Application object instead.

Hope that helps.

OTHER TIPS

Yes the Application version runs on its own thread - so this should be a quicker alternative - easier to do your own stuff whilst it is starting up. However, MapPoint 2010 tends to take a few seconds to start up when started by a user.

I would create a temporary GUI thread and use this to display a splash screen during start up and/or do any thread-safe initialisation that you need to do.

All calls to a MapPoint instance (or ActiveX control) must be from the same thread that create the MapPoint control or application object.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top