MapPoint Forums

MapForums

Community of VE/MapPoint Users and Developers




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 2006/2009 Discussion category; I just asked a friend to run the same code but on his machine that has MapPoint 2004 installed and ...


Go Back   MapPoint Forums > Map Forums > MapPoint 2006/2009 Discussion > Development

Register Blogs FAQ Members List Calendar Search Today's Posts Mark Forums Read



Click here to register

Reply

 

LinkBack (5) Thread Tools Display Modes
  #11 (permalink)  
Old 11-08-2007
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #12 (permalink)  
Old 11-08-2007
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #13 (permalink)  
Old 11-08-2007
Eric Frost's Avatar
Senior Member
Black Belt
 
Join Date: Jul 1992
Posts: 2,487
Blog Entries: 1
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
__________________
~ Now taking orders for MapPoint 2009 ~
~
~ Upgrade to MapForums Plus membership ~
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #14 (permalink)  
Old 11-08-2007
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #15 (permalink)  
Old 11-08-2007
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #16 (permalink)  
Old 11-08-2007
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #17 (permalink)  
Old 11-08-2007
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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #18 (permalink)  
Old 11-08-2007
Eric Frost's Avatar
Senior Member
Black Belt
 
Join Date: Jul 1992
Posts: 2,487
Blog Entries: 1
Re: Different results from ActiveX Control and API

Wow good work in solving that. It didn't occur to me..
__________________
~ Now taking orders for MapPoint 2009 ~
~
~ Upgrade to MapForums Plus membership ~
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
  #19 (permalink)  
Old 11-08-2007
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
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
activex, api, control, results


LinkBacks (?)
LinkBack to this Thread: http://www.mapforums.com/different-results-activex-control-api-6657.html

Posted By For Type Date
Apple Blog » Blog Archive » Different results from ActiveX Control and API This thread Pingback 11-05-2007 05:57 PM
Create 3D Map Video - Win a Free Zune from Microsoft - MapPoint News - MP2K Magazine This thread Refback 11-05-2007 07:48 AM
Merging Multiple Routes - MapPoint Articles - MP2K Magazine This thread Refback 11-04-2007 05:15 PM
Determing Whether A Point Is Located Inside Polygon - MapPoint Articles - MP2K Magazine This thread Refback 11-02-2007 08:43 AM
Programming MapPoint via .NET - MapPoint Articles - MP2K Magazine This thread Refback 11-02-2007 08:38 AM

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
Error using ActiveX control in VB 6 bgower MapPoint 2006/2009 Discussion 2 09-16-2005 09:40 AM
Re: Keyboard control in mappoint activex control djcapslock MapPoint 2006/2009 Discussion 1 03-10-2005 11:16 AM
mappoint ActiveX control 9.0 Anonymous MapPoint 2006/2009 Discussion 1 10-21-2004 07:22 AM
ActiveX Control Anonymous MapPoint 2006/2009 Discussion 3 09-04-2002 06:44 PM


All times are GMT -5. The time now is 12:08 PM.


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