如何在windows phone 8地图中计算速度
本文关键字:地图 计算 速度 phone windows | 更新日期: 2023-09-27 18:00:33
我在一个windows maps API中使用HERE maps API。我想知道如何计算车辆的速度?
我尝试过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;
}
请确保将"位置精度"设置为"高",否则"速度"读数始终为NaN。
如果其他方法失败,请检查获得的坐标之间的距离,并使用点之间的时间来确定速度。这当然不是很准确,但至少可以给出某种速度估计。