[英]How to find Distance Between two Places using MapPoint using C# using Windows Application?
I am finding distance between two places using the following code but it is slow takes around 1 minute. 我正在使用以下代码查找两个地方之间的距离,但速度很慢,大约需要1分钟。
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();
Hi use this following code 嗨,使用以下代码
Instead of .active route calculation 代替.active路由计算
use c as like this way otherwise :var c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1-a)); 像这样使用c,否则:var c = 2 * Math.atan2(Math.sqrt(a),Math.sqrt(1-a));
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.