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 2 of 2 FirstFirst 12
Results 11 to 19 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; I just asked a friend to run the same code but on his machine that has MapPoint 2004 installed and ...

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

    Re: Different results from ActiveX Control and API

    I just asked a friend to run the same code but on his machine that has MapPoint 2004 installed and he gets the correct distance.

    So somewhere Microsoft has changed some default setting between 2004 and 2006 but only for the ApplicationClass. Drawing it onto the map still works and gives the correct distances.

    This is really frustrating !!

    I'll continue to look at the DriverProfile Settings.

    // Michael

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

    Re: Different results from ActiveX Control and API

    I have now checked DriverProfile settings and on both the Control and the ApplicationClass I have the same settings for PreferredRoads (0.5 for all).

    The speed is however different.
    ApplicationClass:
    Debug.WriteLine(route.DriverProfile.get_Speed(GeoRoadType.geoRoadArterial)); --> 34
    Debug.WriteLine(route.DriverProfile.get_Speed(GeoRoadType.geoRoadInterstate)); --> 70
    Debug.WriteLine(route.DriverProfile.get_Speed(GeoRoadType.geoRoadOtherHighway)); -->40

    Using the Map I get:
    Debug.WriteLine(route.DriverProfile.get_Speed(GeoRoadType.geoRoadArterial)); --> 55
    Debug.WriteLine(route.DriverProfile.get_Speed(GeoRoadType.geoRoadInterstate)); --> 113
    Debug.WriteLine(route.DriverProfile.get_Speed(GeoRoadType.geoRoadOtherHighway)); -->65

    But I don't see how the speed could affect anything since my problem is that I get the how this could affect the distance.

    Now I'm getting really desperate.

    Any help would be really appreciated /
    Michael

  3. #13
    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

    Based on the relative speeds - it might take a different path.

    E.g. imagine if Arterial and OtherHighway are both 20 mph, but Interstate is 200 mph, then given a choice it will be more likely to take the Interstate even if it is a longer distance.

    Could this be the explanation?

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

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

    Re: Different results from ActiveX Control and API

    Aah, I didn't think of that.

    I'll try it right away and post my result here.

    Thanks / Michael

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

    Re: Different results from ActiveX Control and API

    I'm afraid that didn't do any difference.
    I set the speed to the same values, but I still get the same result.

    I'm now getting lots of complaints since the upgrade.

    This is really strange

    What more do you nedd when calculating the distance using the object library.
    I've checked the coordinates and now I've checked the DriverProfile.

    The calculation 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;

    My last try looked like this:
    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.DriverProfile.set_Speed(GeoRoadType.geoRoadArterial, 55);
    route.DriverProfile.set_Speed(GeoRoadType.geoRoadInterstate, 113);
    route.DriverProfile.set_Speed(GeoRoadType.geoRoadOtherHighway, 65);



    route.Calculate();
    return route.Distance;

    Regards / Michael

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

    Re: Different results from ActiveX Control and API

    If it's any clue. All complaints I've got so far is that the distances are now to short.

    Regards / Michael

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

    Re: Different results from ActiveX Control and API

    Finally I figured it out.
    The difference seems to be that the deafult value is now miles instead of kilometers like it was in 2004.

    The strange thing was that this only seems to be the case when using the ApplicationClass and not when using the control.

    map.Application.Units = GeoUnits.geoKm;

    solved my problems, finally

    Thanks for all the help that helped in the right direction.

    Regards / Michael

  8. #18
    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

    Wow good work in solving that. It didn't occur to me..
    ~ Order MapPoint MapPoint 2013 Here and Get Free Access to the MapForums Downloads ~
    ~~
    ~ Upgrade to Get Access to the MapForums Downloads ~

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

    Re: Different results from ActiveX Control and API

    Thanks!
    It took me a long time to find it.
    Partly because I trusted the documentation that says:

    Units property

    Returns or sets the unit of measurement used to measure distance; similar to clicking Options on the Tools menu. Default value is geoMiles in MapPoint North America and geoKm in MapPoint Europe.

    // Michael

Page 2 of 2 FirstFirst 12

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