【发布时间】:2019-09-26 14:03:42
【问题描述】:
当我在 Xamarin 中使用 CalculateDistance() 方法计算时,我在 Google 地图上获得了不同的距离。如何计算 Xamarin 中的行驶距离?有什么方法可以用来计算 c# / Xamarin 中的地图距离吗?
以下代码计算两个位置之间的距离。但这与谷歌地图上的行驶距离不同。
var location = new Location(21.705723, 72.998199);
var otherLocation = new Location(22.3142, 73.1752);
double distance = location.CalculateDistance(otherLocation,DistanceUnits.Kilometers);
【问题讨论】:
-
这段代码是直接点对点的,但你说谷歌地图是“行驶距离”,包括转弯等。为什么你会期望它们是一样的?
标签: c# google-maps xamarin.forms