How to check if my current location is on the route that i draw befor, and if not, redraw route

后端 未结 1 726
[愿得一人]
[愿得一人] 2021-01-27 07:43

How to check if my current location is on the route that I draw before, and if not, redraw route.

So how I think: we have something like this:

ArrayLis         


        
相关标签:
1条回答
  • 2021-01-27 08:07

    The basic way is - you have to check if your current position is near some of previously registered points Location class has a method to measure distance to other location.

    For performance - you can adopt Pitagoras formula - just remember that degree of latitude is (quite) constant and the degree of longitude varies depending on current latitude length_of_longitude_degree = cos(latitude). Location distance (no sure name of this method) is based on some sophisticated geometry, "real" shape of earth etc. so it's not wise to use it against few thousands geo points.

    0 讨论(0)
提交回复
热议问题