MapPoint Map Refresh

andreaplanet
01-22-2005, 02:10 PM
Hello,

I'm using VB6 and the Mappoint control to build a EXE that include some map functionalities. The problem is that when I add a pushpin or other items on the map then the map is updated at every code instruction. Is there a way to draw some items without updating the map at every instruction?

Example of code

Set item = myMap.Shapes.AddLine(loc1,loc2)
item.Line.ForeColor = intForeColor
item.Line.EndArrowhead = True
item.Line.Weight = 0


When I run this code I see first the blackline, then the arrow, at last the weight.

Same problem when creating pushpins. In this case first I see the pushpin icon then the car icon (myDataSet has Symbol=car)


Set item = myMap.AddPushpin(loc1, "MyName")
item.MoveTo myDataSet


Is there a way to run easily some code in the MapPoint thread? I think at every instruction there is the delay for the thread switch between my application and the hidden mappoint application.

Thank you for any help

Anonymous
01-23-2005, 06:53 AM
You want to use a Dataset to perform batch pushpin assignment.


Tim Miltz

Wilfried
01-23-2005, 09:47 AM
Hi,

The problem is that when I add a pushpin or other items on the map then the map is updated at every code instruction. Is there a way to draw some items without updating the map at every instruction?

I think this is typical behaviour of MP2004. With MP2002 this was not the case. The updating slows down but for a user it 'seems' faster. I have search but did not found any property/method to disable it.

Is there a way to run easily some code in the MapPoint thread? I think at every instruction there is the delay for the thread switch between my application and the hidden mappoint application.

I'm pretty sure that all GUI updates happens in same main thread context. Also all method calls to MP are sync, if they should execute in a separate thread they would by async. However this is just a conclusion of me without knowing the deeper insights of mappoint. Someone will clarify if I'm wrong I hope :)

andreaplanet
01-23-2005, 10:04 AM
I'm pretty sure that all GUI updates happens in same main thread context. Also all method calls to MP are sync, if they should execute in a separate thread they would by async. However this is just a conclusion of me without knowing the deeper insights of mappoint. Someone will clarify if I'm wrong I hope :)

Hi Wilfried,

When you run the map there is a "hidden" process "MapPoint.exe", check the taskmanager, so there is some kind of interprocess comunication. And I fear that this happen at every instruction call. It's relatively fast, in other similar situations i realized a delay of some milliseconds for every instructions due to the necessary context switch between the two processes. I still not tried to add something like 10000 items but I fear that the process will be very slow.

Wilfried
01-23-2005, 11:17 AM
Hi,

Yes, for each mappoint component you drop on a form a mappoint.exe instance is started in background. mapooint.exe is in this case a COM server for your application. Each method is sent to it and returns with the appropriate data.

Of course this gives delays, and if you wants to drop honderds or more pushpins on your map you will have incredible delays. But these delays are not nececarly because the delay of interprocess.

For a large amount of data is nececarly to study (or better trial and error) to see what the most gain gives in speed. Not very easy all the time :(

discostu
06-07-2005, 04:17 PM
You want to use a Dataset to perform batch pushpin assignment.


Tim Miltz

How would one do this? There doesn't seem to be any way to AddPushpin(...) to a DataSet. At least I haven't found it yet.

Blackbird
11-27-2006, 02:56 AM
I have the exact same problem as Andreaplanet. Creating many pushpins at the same time takes very long because the addPushpin() method automatically refreshes the map.

I need to disable the map auto-refresh.

jlewis
11-27-2006, 09:10 AM
I had much the same problem using addPushpin for a whole bunch of pushpins. On my dev machine, adding about 3000 pushpins (from my db) used to take between 90 and 120 seconds.

What I now do is to export my data into a CSV (with 3 columns - Latitude,Longitude,Name) and then use the ImportData method:-

Dim ds As MapPoint.DataSet
ds = Map.DataSets.ImportData(Filename)
ds.Symbol = 1 [or whatever symbol you want]

The same 3000 pushpins now take about 3 seconds to load!

John

Blackbird
11-27-2006, 09:19 AM
What I now do is to export my data into a CSV (with 3 columns - Latitude,Longitude,Name) and then use the ImportData method

Seems a very good workaround to me, thanks.

But disabling the auto-refresh would still be a better solution. Anyway, this workaround will be very useful, even though not the solution I was looking for.

Eric Frost
11-27-2006, 10:30 AM
I wonder if it will speed it up if you make the Application not visible? (Set visible to False.)

Eric

Blackbird
11-27-2006, 11:06 AM
I wonder if it will speed it up if you make the Application not visible? (Set visible to False.)

Didn't change much in my case :

To display 12700 pushpins :
- ActiveX visible during the pushpin creation phase : 3min 00sec
- ActiveX not visible during the pushpin creation phase : 2min 50sec
(Based on a single test)

Wilfried
11-29-2006, 04:07 AM
Hi,

Instead of displaying 12000 pushpins what no human eye can read, you can display exact what is needed, so only pushpins that are in view, and the amount eventually depending on the zoom level. This of course will need some algoritms that may not be simple but you will have higher speed on map.

 
Web mp2kmag.com
mapforums.com