我使用HERE地圖API在我的Windows地圖API之一。我想知道如何計算車輛的速度?如何計算Windows Phone 8地圖的速度?
我嘗試過使用GeoCoordinate.speed屬性,它始終返回NaN。 GeoCoordinate觀察員也爲我返回NaN。
請建議一些很好的方法來做到這一點。
在此先感謝。
我使用HERE地圖API在我的Windows地圖API之一。我想知道如何計算車輛的速度?如何計算Windows Phone 8地圖的速度?
我嘗試過使用GeoCoordinate.speed屬性,它始終返回NaN。 GeoCoordinate觀察員也爲我返回NaN。
請建議一些很好的方法來做到這一點。
在此先感謝。
如果其他方法失敗,則檢查您獲得的座標之間的距離,並使用點之間的時間來確定速度。這當然不是很準確,但至少會提供一些速度估計。
我不知道你是否使用Geolocator類。 您可以使用它像這樣:
Geolocator geolocator = new Geolocator
{
DesiredAccuracy = PositionAccuracy.High
};
geolocator.PositionChanged += geolocator_PositionChanged;
private static void geolocator_PositionChanged(Geolocator sender, PositionChangedEventArgs args)
{
var speed = args.Position.Coordinate.Speed;
}
一定要PositionAccuracy設置爲高,否則你永遠得到的NaN的快速閱讀。
謝謝您的回覆。我會檢查。 – user2936076