How do we measure our speed with location.(speedometer)

Yes, your postulation is basically correct. To record a speed the LocationSensor.LocationChanged must fire at least twice to get a speed rerading. To calculate a speed, the tool must record two separate geolocations. Speed is the rate at which an object's position changes, measured in meters per second. The equation for speed is simple: distance divided by time.Take the distance traveled (for example the distance from the geolocation of satellite fix #1 to satellite fix #2 . Divide the distance by the time to get the speed . The LocationSensor takes care of that for you.

In your instance, two things make displaying a speed impossible. The distance traveled and the TimeInterval of the sampling (which if you use the defaults for the LS is 60000 ms (1 minute). Under the best of conditions, the gps can only measure to a precision of 2 meters and usually is not accurate as 10 meters of where the gps says it is. Waving your cell phone in the air might travel perhaps a meter (if you have long arms). To achieve the second satellite fix will take 60 seconds.

To see this in action, run your app while riding your bicycle or five or ten minutes and you should see a result (be careful while reading the result or the result might be zero when you fall) or take a ride in a car or train and see how many meters per second you are traveling. :slight_smile:

Did you have an opportunity to test it while you are moving fast for at least several minutes?

Regards,
Steve

1 Like