Welcome to MapForums!

Register, sign in, or use Facebook Connect above to join in and participate in the forum.

When you are signed in, this message, the ads in this row, and the red-underlined link ads all go away.

Subscribe to receive our newsletter.
Subscribe Unsubscribe
Page 1 of 3 123 LastLast
Results 1 to 10 of 21

route drawing too slow for many locations

This is a discussion on route drawing too slow for many locations within the MapPoint Desktop 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 ...

  1. #1
    gucelli is offline 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

  2. #2
    VC_Man is offline Member Green Belt
    Join Date
    Nov 2006
    Posts
    93

    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 ).

  3. #3
    gucelli is offline 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?!

  4. #4
    VC_Man is offline Member Green Belt
    Join Date
    Nov 2006
    Posts
    93

    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.

  5. #5
    gucelli is offline 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

  6. #6
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433

    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

  7. #7
    VC_Man is offline Member Green Belt
    Join Date
    Nov 2006
    Posts
    93

    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

  8. #8
    gucelli is offline 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

  9. #9
    Wilfried is offline Senior Member Black Belt
    Join Date
    Nov 2004
    Location
    Belgium
    Posts
    2,433

    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;

  10. #10
    VC_Man is offline Member Green Belt
    Join Date
    Nov 2006
    Posts
    93

    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.

Page 1 of 3 123 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Find all exact locations along a route
    By PorkChopper in forum MapPoint Desktop Discussion
    Replies: 5
    Last Post: 07-14-2009, 02:56 PM
  2. Slow response time on route requests
    By cgoudy in forum MapPoint Desktop Discussion
    Replies: 3
    Last Post: 01-25-2007, 08:36 AM
  3. Drawing more than one route at a time
    By chpw in forum MapPoint Desktop Discussion
    Replies: 6
    Last Post: 02-28-2006, 04:20 AM
  4. Drawing route as I go.
    By z_darius in forum MapPoint Desktop Discussion
    Replies: 6
    Last Post: 02-10-2006, 09:57 AM
  5. MapPoint Route Drawing
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 0
    Last Post: 10-21-2002, 10:05 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


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 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96