MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




route drawing too slow for many locations

This is a discussion on route drawing too slow for many locations within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; Hi all, I'm developing an MFC C++ application that uses the MappointControl OCX. One of the functionalities I need to ...


Go Back   MapPoint Forums > Map Forums > MapPoint 2006/2009 Discussion

Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read



Click here to register

Reply

 

LinkBack (1) Thread Tools Display Modes
  1 links from elsewhere to this Post. Click to view. #1 (permalink)  
Old 03-06-2007
Junior Member
White Belt
 
Join Date: Mar 2007
Location: Italy
Posts: 4
route drawing too slow for many locations

Hi all,
I'm developing an MFC C++ application that uses the MappointControl OCX.
One of the functionalities I need to cover is to show a vehicle route. The route can be made even of thousand of positions in the map.

I tried to draw the route creating pushpins for the different vehicle locations and drawing lines between one position and the next one.
For 3000 positions my application hang up for 1'20'' (1 minute and 20 seconds). This is a bug for my customer-)

I tried using shapes instead of pushpins, but the problem remains.

I finally tried using a polyline: that does work, the route is drawn in an acceptable time, but I still have the problem to show a given symbol at every location (vehicle position).
Obviously I'm able to retrieve the polyline vertices, but I still got the problem of a 3000 loop cycle for shapes creation, so the bottle-of-neck remains.

Is there a way to draw thousand of shapes (or maybe pushpins?!) at given locations in an acceptable time (max 10 seconds) ?
thanx in advance for the help you can provide to me
bye
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #2 (permalink)  
Old 03-06-2007
Member
Green Belt
 
Join Date: Nov 2006
Posts: 87
Re: route drawing too slow for many locations

Gucelli,

Do you have to draw pushpins also? Cuz I think that's the most time-consuming part. If you just use Location objects, than you can create a seperate DataSet for a all the lines you'll draw from location object to location object. But if you have to draw also the pushpins all over again, that will be time consuming. So I'm afraid you won't solve that problem, but I hope I'm wrong.

I use a selfdrawn bitmap, write on disk, and than import it to Mappoint from disk. With more than 50 pushpins my app eats almost 100% of the CPU for a few seconds. That's because of the pushpins (I've drawn programmatically ).
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #3 (permalink)  
Old 03-06-2007
Junior Member
White Belt
 
Join Date: Mar 2007
Location: Italy
Posts: 4
Re: route drawing too slow for many locations

Hi VC_Man,
thanks for the post. The target I need to achieve is
  1. to show a symbol like a red square at every position
  2. to show a line that connects all the positions, just like a route.
I can obtain my red square with pushpins on with shapes, but for a thousand of positions the application hangs up in an unacceptable manner. Probably drawing shapes is less CPU-consuming than drawing pushpins, but I'm not sure.

The polyline creation solves the 2nd part of the problem, all the route appears in some seconds. But I still cannot get point 1.

So I was wondering if there could be a way to add the shapes to some dataset and then show them all in one shot ... hoping this (existent?!) procedure to be less time consuming ...

... hey ... is there anybody out there who can give an answer?!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #4 (permalink)  
Old 03-06-2007
Member
Green Belt
 
Join Date: Nov 2006
Posts: 87
Re: route drawing too slow for many locations

Gucelli,

Can you try to give each red square pushpin a unique name? For example like giving a pushpin a name of the count. I think this gives you the solution. Cuz when you create a new pushpin with the same symbol and the same name, after 100 pushpins it eats all of the cpu and than it hangs (or from 200 pushpins). Please give each red squared pushpin a unique name. Cuz I had that problem too.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #5 (permalink)  
Old 03-06-2007
Junior Member
White Belt
 
Join Date: Mar 2007
Location: Italy
Posts: 4
Re: route drawing too slow for many locations

VC_MAN,
the implementation was already working with a unique name per pushpin, when I tried the pushpin-based solution of my problem.
Unfortunately that's not the point
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #6 (permalink)  
Old 03-06-2007
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,122
Re: route drawing too slow for many locations

Hi,

Can I make you and your customar happy if you can do it in a few seconds? Euh you have to buy me a beer for this you know

Use ImportData for a so big amount. 5000 vehicles is around 3 seconds

BTW: I also like wine
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #7 (permalink)  
Old 03-07-2007
Member
Green Belt
 
Join Date: Nov 2006
Posts: 87
Re: route drawing too slow for many locations

Well Wilfried,

You already had a lot of beers from me :P

So if somebody uses a lot of pushpins, than you have to use ImportData? Hmm, I've never used it. I hope it helps Gucelli a lot with it. And for you a lot of beer
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #8 (permalink)  
Old 03-07-2007
Junior Member
White Belt
 
Join Date: Mar 2007
Location: Italy
Posts: 4
Re: route drawing too slow for many locations

I Wilfried,
nice to know u.

I tried to understand the correct use of ImportData, but at the moment I can't say how to do my work with that function.

I looked around for a sample, but I can't understand how to import data in order to create a set of pushpins avoiding loop cycles.
Can you give me some hint | show me some link to a good sample of ImportData for the kind of job I need to do?

Thank you very much for the support ... I live in Sardinia, Italy, we got a very good wine here ... happy to invite you some good bootle
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #9 (permalink)  
Old 03-07-2007
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,122
Re: route drawing too slow for many locations

Hi,

This example shows 3000 pushpins on the map. It take less than 2 seconds on my machine. the first part create the file, the last part import it:

Code:
    double lat;
    double lon;
    string fileName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetModules()[0].FullyQualifiedName) + "\\temp.csv";

    TextWriter writer = new StreamWriter(fileName, false);
    try {
	writer.WriteLine("Lat;Lon");
	lat = 51;
	lon = 4;
	for (int k = 0; k < 3000; k++) {
	    writer.WriteLine(lat.ToString() + ";" + lon.ToString());
	    lon += .0003;
	}
    } finally {
	writer.Close();
    }

    MapPoint.DataSet dataSet;
    // Define field specification
    object[,] fieldSpecifications = null;
    fieldSpecifications = new object[2, 2];
    // Specify what fields are geographic and what fields are not
    fieldSpecifications[0, 0] = "Lat";
    fieldSpecifications[0, 1] = MapPoint.GeoFieldType.geoFieldLatitude;
    fieldSpecifications[1, 0] = "Lon";
    fieldSpecifications[1, 1] = MapPoint.GeoFieldType.geoFieldLongitude;
    dataSet = MP.ActiveMap.DataSets.ImportData(fileName, 
					       fieldSpecifications, 
					       MapPoint.GeoCountry.geoCountryDefault,
					       MapPoint.GeoDelimiter.geoDelimiterSemicolon, 0);
    dataSet.Symbol = 37;
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #10 (permalink)  
Old 03-08-2007
Member
Green Belt
 
Join Date: Nov 2006
Posts: 87
Re: route drawing too slow for many locations

Wilfried,

What if I made customdraw symbols and I have 3000 of them (each is a unique custom drawn symbol) on the map for each with its pushpin. Is it also possible to load it into a datamap and than show it again in a very short time, like just seconds?

If that's true, than it would be a great solution for me too!


Thank you.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Tags
drawing, locations, route, slow


LinkBacks (?)
LinkBack to this Thread: http://www.mapforums.com/route-drawing-too-slow-many-locations-5721.html

Posted By For Type Date
Author - MP2K Magazine This thread Refback 03-14-2007 07:05 PM

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
Find all exact locations along a route PorkChopper MapPoint 2006/2009 Discussion 4 04-29-2007 11:13 AM
Slow response time on route requests cgoudy MapPoint 2006/2009 Discussion 3 01-25-2007 08:36 AM
Drawing more than one route at a time chpw MapPoint 2006/2009 Discussion 6 02-28-2006 04:20 AM
Drawing route as I go. z_darius MapPoint 2006/2009 Discussion 6 02-10-2006 09:57 AM
MapPoint Route Drawing Anonymous MapPoint 2006/2009 Discussion 0 10-21-2002 10:05 AM


All times are GMT -5. The time now is 11:05 AM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0
MP2K Magazine
Visitor Map


1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54