Community of VE/MapPoint Users and Developers
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 ...
| |||||||
| Register | Blogs | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| |||
| 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 |
| |||
| 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 |
| |||
| 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 |
| |||
| 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 |
| |||
| 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 |
![]() |
| Tags |
| activex, api, control, results |
| ||||
| 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 | |
| |
| ||||
| 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 |