Calculation of maximum speed and traveled distance Core Location

Good afternoon!

Can you tell me how to calculate the maximum speed of the user? Do you have an example of the implementation of the function?

And also tell me to calculate the distance traveled? Maybe someone has an example of implementation.

My application is a speedometer, used only Core Location.

Thank you!

Answered by Claude31 in 681229022

When you init a CLLocation, you can ask to get speed info at each measure. Then, store this value in an array. And evaluate the max value in the array to get max speed, when you need.

What distance do you want to measure: the travelled or the distance from origin ? For travelled distance, each time you get a CLLocation value, compute the distance from previous point (if update is frequent enough, evaluate this as sort(dx*dx + dy+dy) where (dx, dy) is the delta between the two CLLocation. Then increment a totalDistance Float value to compute the travelled distance so far.

May read this for implementation details.

https://stackoverflow.com/questions/38512443/provide-simple-method-to-get-current-speed-implementing-speedometer

Accepted Answer

When you init a CLLocation, you can ask to get speed info at each measure. Then, store this value in an array. And evaluate the max value in the array to get max speed, when you need.

What distance do you want to measure: the travelled or the distance from origin ? For travelled distance, each time you get a CLLocation value, compute the distance from previous point (if update is frequent enough, evaluate this as sort(dx*dx + dy+dy) where (dx, dy) is the delta between the two CLLocation. Then increment a totalDistance Float value to compute the travelled distance so far.

May read this for implementation details.

https://stackoverflow.com/questions/38512443/provide-simple-method-to-get-current-speed-implementing-speedometer

Hi @Claude31, I’m looking to contract someone with core location services experience and could not find another way to contact you. We have a strong budget for the project and would love to hear from you — if you’re open to work, please message me on LinkedIn @ /DannyHinkle

Calculation of maximum speed and traveled distance Core Location
 
 
Q