【发布时间】:2014-04-29 04:28:15
【问题描述】:
我在我的一个 Windows 地图 API 中使用 HERE 地图 API。我想知道如何计算车辆的速度?
我尝试过一直返回 NaN 的 GeoCoordinate.speed 属性。 GeoCoordinate watcher 也会为我返回 NaN。
请提出一些好的方法。
提前致谢。
【问题讨论】:
标签: c# windows windows-phone-8 maps here-api
我在我的一个 Windows 地图 API 中使用 HERE 地图 API。我想知道如何计算车辆的速度?
我尝试过一直返回 NaN 的 GeoCoordinate.speed 属性。 GeoCoordinate watcher 也会为我返回 NaN。
请提出一些好的方法。
提前致谢。
【问题讨论】:
标签: c# windows windows-phone-8 maps here-api
我不知道您是否使用 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 设置为 High,否则 Speed 读数总是会得到 NaN。
【讨论】:
如果其他方法失败,则检查您获得的坐标之间的距离,并使用点之间的时间来确定速度。这当然不会很准确,但至少会给出某种速度估计。
【讨论】: