MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




saving mappoint route in a file

This is a discussion on saving mappoint route in a file within the MapPoint 2006/2009 Discussion forums, part of the Map Forums category; Hello, what I'm trying to do is to create a route with mappoint and then to save it in a ...


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 Thread Tools Display Modes
  #1 (permalink)  
Old 08-30-2006
Junior Member
Yellow Belt
 
Join Date: May 2006
Posts: 12
Send a message via ICQ to giaarcix Send a message via MSN to giaarcix
saving mappoint route in a file

Hello,
what I'm trying to do is to create a route with mappoint and then to save it in a file.
My program should be able to build some routes for different cars, and this part is ok.
Then I need to save all the routes somewhere in my pc, so that I'll be able to pick a car and to see the relative route.
But I don't need an image of the route: I need an object witch I can use in my code. Is this possible?
I hope I've been clear..... Thank you very much,

Giacomo from Italy
__________________
Bisogna sognare, insistere, ripetere, finchè il sogno si trasformi in realtà
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 08-30-2006
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,122
Hi,

Yes easy to do:

Code:
    for (int i = 0; i < route.Directions.Count; i++) {
        object o = i;
        MapPoint.Direction direction = route.Directions.get_Item(ref o);
        // here you have each direction with all his properties
    }
You cannot use foreach because foreach is not in the right sequence !
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 09-26-2006
Junior Member
Yellow Belt
 
Join Date: May 2006
Posts: 12
Send a message via ICQ to giaarcix Send a message via MSN to giaarcix
Other question...

Hi,
I'm back on the problem. Actually I am writing code in Visual Basic on Mappoint 2006.
To save the route I did so:

For i = 1 To objRoute.Directions.Count
Set objLoc = objRoute.Directions.Item(i).Location
coordinates = get_coordinates_from_objloc(objLoc) 'My routine
Call save_coordinates(coordinates, "my_car") 'My routine
Next

I create an objLoc for each direction into the objRoute, I find the coordinates of every objLoc and I save them into a text file so that when I quit the program I have still saved into my computer the route.
BUT: is there another way to do this? It seems to me to be a so long process if the route is very long... and I'm not sure that my routine get_coordinates_from_objloc(objLoc) works perfectly!
Isn't there a way to save the objRoute directly into a file?
Thank you so much!

Giacomo from Italy
__________________
Bisogna sognare, insistere, ripetere, finchè il sogno si trasformi in realtà
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 09-26-2006
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,122
Hi,

As far as I know there is no other way. But I think this way will be fast, and you must be sure that your get_coordinates_from_objloc(objLoc) works perfecly
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 09-27-2006
Junior Member
Yellow Belt
 
Join Date: May 2006
Posts: 12
Send a message via ICQ to giaarcix Send a message via MSN to giaarcix
But....

Thank you.. actually I've just realized that the bug is not into my function get_coordinates_from_objloc(objLoc)! It seems to be into the objRoute.Directions!
Try running this code (this time on Mappoint2004, actually I can't try on 2006).
You'll see that the route is well calculated beetween Milan and Rome, but when I cicle on the directions not all the waypoints are the right ones.
Is there something wrong in my code (where???), or, as I believe, there is bug in Mappoint?

Private Sub Form_Load()

Dim objMap As MapPointctl.Map
Dim objLoc1 As MapPointctl.Location
Dim objLoc2 As MapPointctl.Location
Dim objLoc3 As MapPointctl.Location
Dim objpushpin As MapPointctl.Pushpin

MappointControl1.NewMap geoMapEurope

Set objMap = MappointControl1.ActiveMap

Set objMap = MappointControl1.ActiveMap
Set objRoute = objMap.ActiveRoute

Set objLoc1 = objMap.FindResults("Milan")(1)
Set objLoc2 = objMap.FindResults("Rome")(1)

objRoute.Waypoints.Add objLoc1
objRoute.Waypoints.Add objLoc2

objRoute.Calculate
MappointControl1.ItineraryVisible = False

For i = 1 To objRoute.Directions.Count
Set objLoc3 = objRoute.Directions.Item(i).Location

Set objpushpin = objMap.AddPushpin(objLoc3)
objpushpin.Highlight = True
objLoc3.GoTo

Next

End Sub
__________________
Bisogna sognare, insistere, ripetere, finchè il sogno si trasformi in realtà
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 09-28-2006
Senior Member
Black Belt
 
Join Date: Nov 2004
Posts: 2,122
Hi,

You have to check if the given item is indeed a waypoint.
In C# it is something like this:

Code:
for (int i = 1; i <= route.Directions.Count; i++) {
        o = i;
        object wp = route.Directions.get_Item(ref o) as Waypoint;
        if (wp == null)
            continue;
        // and here the rest of your code
Should be something similar in VB, but if I try to do it I will type more syntax errors and confuse everyone including myself

I tryed it out and the strange pushpins (one even 15 km of the route) are away now
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
file, mappoint, route, saving


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
MapPoint hangs when saving map as HTML tfmiltz MapPoint 2006/2009 Discussion 3 09-13-2005 02:16 PM
Saving Updated Territories from the MapPoint ActiveX Control pauldivaniii MapPoint 2006/2009 Discussion 0 05-25-2005 12:18 AM
Closing without saving Mudrover MapPoint 2006/2009 Discussion 1 01-30-2005 08:49 AM
Tracking Route And Save To File (possible to do this?) Anonymous MapPoint 2006/2009 Discussion 2 04-08-2004 07:14 AM
Pushpins of Legend while saving file as .htm Anonymous MapPoint 2006/2009 Discussion 1 07-24-2003 01:32 PM


All times are GMT -5. The time now is 01:25 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 55