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 2 12 LastLast
Results 1 to 10 of 19

Different results from ActiveX Control and API

This is a discussion on Different results from ActiveX Control and API within the Development forums, part of the MapPoint Desktop Discussion category; Hi! I have two different applications one test-application that displays a map and another one that is just a server ...

  1. #1
    micnik is offline Junior Member Yellow Belt
    Join Date
    Sep 2007
    Posts
    16

    Different results from ActiveX Control and API

    Hi!
    I have two different applications one test-application that displays a map and another one that is just a server application.
    Both have worked fine for a long time but recently I got a complaint for a calculated distance.

    When I run my server application I get approx: 9.75 km.
    Using the test-application I get approx: 15.7 km which seems much better.

    The positions are:
    Start Lat: 59.2686233333333
    Long: 18.019825

    Stop Lat: 59.3085966666667
    Long: 18.2301466666667

    Im using MapPoint 2006 (Europe)
    The code for the server application looks like:

    Map map = MapPointApp.ActiveMap;
    map.ActiveRoute.Clear(); //clear the route if one exists
    Route route = map.ActiveRoute;
    route.Waypoints.Add(fromLocation, "Start");
    route.Waypoints.Add(toLocation, "End");
    route.Calculate();
    return route.Distance;


    And the code for the test-application looks like:

    axMappointControl1.ActiveMap.ActiveRoute.Clear(); //clear the route if one exists
    Route oRoute = axMappointControl1.ActiveMap.ActiveRoute;
    oRoute.Waypoints.Add(FromLocation, "Start");
    oRoute.Waypoints.Add(ToLocation, "End");
    oRoute.Calculate();
    axMappointControl1.ItineraryVisible = false; //hide the directions pane
    MessageBox.Show(oRoute.Distance + " km");

    Any help would be appreciated / Michael

  2. #2
    Mattys Consulting's Avatar
    Mattys Consulting is offline Senior Member Black Belt
    Join Date
    Dec 2002
    Posts
    1,040

    Re: Different results from ActiveX Control and API

    Michael,

    I plotted the route and got all highway 16.x km
    Are the "Preferred" settings different on the machines?

    Mike Mattys

  3. #3
    micnik is offline Junior Member Yellow Belt
    Join Date
    Sep 2007
    Posts
    16

    Re: Different results from ActiveX Control and API

    Hi Mike!
    I'm not sure whatt settings you're referring to, but when I tried to figure out what was happening I ran both applications on the same machine.

    When you say "plotted the route" I assume that you used the ActiveX control. So it seems that using that you get almost the same result as I do.

    It's the other result when I'm using the "Microsoft MapPoint 13.0 Object Library (Europe)" that I get the strange distance.

    Regards / Michael

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

    Re: Different results from ActiveX Control and API

    Hi,

    Possible the default preferred settings are different using the object model versus the activeX control. You have to set them in both of the programs the same.

  5. #5
    micnik is offline Junior Member Yellow Belt
    Join Date
    Sep 2007
    Posts
    16

    Re: Different results from ActiveX Control and API

    Hi!
    Now I understand that I misunderstood the first reply

    How do I check/set default preferred settings?

    Thanks in advance / Michael

  6. #6
    micnik is offline Junior Member Yellow Belt
    Join Date
    Sep 2007
    Posts
    16

    Re: Different results from ActiveX Control and API

    Can this problem in any way have anything to do with the fact that I upgraded fråm version 2004 to 2006?

    Regards / Michael

  7. #7
    Eric Frost's Avatar
    Eric Frost is offline Administrator Black Belt
    Join Date
    Jul 1992
    Posts
    5,094
    Blog Entries
    4

    Re: Different results from ActiveX Control and API

    Is MapPoint 2004 still installed? Maybe when you run the ActiveX it is still opening MapPoint 2004.

    Eric
    ~ Order MapPoint MapPoint 2013 Here and Get Free Access to the MapForums Downloads ~
    ~~
    ~ Upgrade to Get Access to the MapForums Downloads ~

  8. #8
    micnik is offline Junior Member Yellow Belt
    Join Date
    Sep 2007
    Posts
    16

    Re: Different results from ActiveX Control and API

    Hi!
    No I deinstalled 2004 before installing 2006 and after reading your post I also searched my harddrive to make sure there was no old version of MappointControl.ocx laying around.

    Regards / Michael

  9. #9
    Eric Frost's Avatar
    Eric Frost is offline Administrator Black Belt
    Join Date
    Jul 1992
    Posts
    5,094
    Blog Entries
    4

    DriverProfile

    Quote Originally Posted by micnik View Post
    How do I check/set default preferred settings?
    Check in the Help file, there is the PreferredRoads property of the DriverProfile object. Also, there are methods to reset the roads and PreferredSpeeds:

    DriverProfile object

    The DriverProfile object contains preferences for generating routes, such as travel time, methods for determining route costs, preferred roads, and so on. This object is invalidated after the map is closed.

    Methods

    ResetPreferredRoads
    ResetSpeeds
    ~ Order MapPoint MapPoint 2013 Here and Get Free Access to the MapForums Downloads ~
    ~~
    ~ Upgrade to Get Access to the MapForums Downloads ~

  10. #10
    micnik is offline Junior Member Yellow Belt
    Join Date
    Sep 2007
    Posts
    16

    Re: Different results from ActiveX Control and API

    Thanks a lot!
    I'll try it out and see what I can find.

    Regards / Michael

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Error using ActiveX control in VB 6
    By bgower in forum MapPoint Desktop Discussion
    Replies: 2
    Last Post: 09-16-2005, 09:40 AM
  2. Re: Keyboard control in mappoint activex control
    By djcapslock in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 03-10-2005, 11:16 AM
  3. mappoint ActiveX control 9.0
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 1
    Last Post: 10-21-2004, 07:22 AM
  4. ActiveX Control
    By Anonymous in forum MapPoint Desktop Discussion
    Replies: 3
    Last Post: 09-04-2002, 06:44 PM

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