0

I am finding distance between two places using the following code but it is slow takes around 1 minute.

MapPoint.Application objApp = new MapPoint.Application();
        MapPoint.Map objMap = null;
        objMap = objApp.ActiveMap;
        Object obj1 = 1;
        objMap.ActiveRoute.Waypoints.Add(objMap.FindResults(txtfrom.Text)
           .get_Item(ref obj1), "");
        objMap.ActiveRoute.Waypoints.Add(objMap.FindResults(txtTo.Text)
           .get_Item(ref obj1), "");
        objMap.ActiveRoute.Calculate();
        txtMiles.Text = objMap.ActiveRoute.Distance.ToString();
Anjali
  • 1,680
  • 4
  • 26
  • 48

1 Answers1

0

Hi use this following code

Instead of .active route calculation

enter image description here

use c as like this way otherwise :var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a));

Cherry
  • 675
  • 3
  • 10
  • 28