Calculating Speed for a navigation app without getSpeed() method

前端 未结 4 1122
野性不改
野性不改 2020-12-28 23:42

I am developing an app which is more of a time-shift racing between your friends.

I need to calculate speed of a moving vehicle, and I don\'t want to use Locat

4条回答
  •  长发绾君心
    2020-12-29 00:42

    I agree with Pierre, also you are rounding the results. If the points are not far enough apart, you're rounding may just provide 0. I don't see how the rounding tolerance is defined. I always calculate in meters - it makes things much easier. I'd suggest following the SI standard units in your code. Your output also shows that the timeDelta is zero, so no distance was actually calculated.

提交回复
热议问题