View Single Post

  #5 (permalink)  
Old 08-24-2005
Srini Srini is offline
Junior Member
White Belt
 
Join Date: Aug 2005
Posts: 4
I tried this trick but it does not work. The idea was to get the drive time and distance to a very close location and compute the speed. But the speed is too low. Either I am missing something or Mappoint takes into consideration turns and stops etc.

try
{
MapPoint.Location Loc;
Loc = MP.ActiveMap.GetLocation(32.897125,-117.119782,1.0);
MP.ActiveMap.ActiveRoute.Waypoints.Add(Loc,"Loc1") ;
MapPoint.FindResults FR = Loc.FindNearby(1.0);
object O = null;
//Get the farthest object
foreach(object L in FR)
{
O = L;
}
MP.ActiveMap.ActiveRoute.Waypoints.Add(O,"Loc2");
MP.ActiveMap.ActiveRoute.Calculate();
double d = MP.ActiveMap.ActiveRoute.Distance;
double t = MP.ActiveMap.ActiveRoute.DrivingTime ;
double t1 = t*24; //Same result if divide by geoOneHour
double s = d/t1;
MessageBox.Show("Distance = " + d.ToString() + "\r\nTime=" + t1.ToString() + "\r\nSpeed=" + s.ToString(),"Ave Speed" );
}
catch(Exception E)
{
MessageBox.Show(E.Message.ToString());
}

Can anyone shed some light on why the result is not correct ? The speed comes to around 4 MPH if get the nearest and about 12 for farthest.

Thanks
Reply With Quote