Community of VE/MapPoint Users and Developers
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 ...
| |||||||
| Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| route drawing too slow for many locations 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 |
| |||
| 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 ). |
| |||
| Re: route drawing too slow for many locations
Hi VC_Man, thanks for the post. The target I need to achieve is
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?! |
| |||
| 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. |
| |||
| 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 |
| |||
| 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
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
| |||
| 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 |
| |||
| 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 |
| |||
| 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;
__________________ rgds, Wilfried Mestdagh www.mestdagh.biz MapPoint coding demo Order MapPoint 2009 with Routing and User Tools Spreadsheet |
| |||
| 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. |
![]() |
| Tags |
| drawing, locations, route, slow |
| ||||
| 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 | |
| |
| ||||
| 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 |