user2936076
user2936076

Reputation: 1

How to calculate speed in windows phone 8 maps?

I am using HERE maps API in one of my windows maps api. I would like to know how can I calculate the speed of the vehicle?

I have tried with GeoCoordinate.speed property which returns NaN all the time. GeoCoordinate watcher also returns NaN for me.

Please suggest some good methods to do so.

Thanks in advance.

Upvotes: 0

Views: 528

Answers (2)

meneses.pt
meneses.pt

Reputation: 2616

I don't know if you are using the Geolocator class. You can use it like this:

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;
}

Be sure to set PositionAccuracy to High, otherwise you'll always get NaN for the Speed reading.

Upvotes: 1

Dr.Jukka
Dr.Jukka

Reputation: 2396

If other means fails, then check the distance between coordinates you get, and use the time between the points to determine the speed. This of course would not be very accurate, but at least would give somekind of speed estimate.

Upvotes: 0

Related Questions