MKnnotation smooth movement on MKPolyline

I am working on an application that can offer routes from point A to point B on the map.

I draw routes using MKPolyline.

My problem is that when a route is suggested, and the application user monitors the route, the user's current location (blue dot) may be inaccurate (skips, especially in the city center, even with BestForNavigation LocationManager accuracy).

I would like to have another MKAnnotation in addition to the current location of the blue dot, which smoothly tracks the user's movement on the route.

I could not find the code for this. Does anyone have any ideas or sample code? Perhaps using Kalman filters?

My resources for such a task are taken from the LocationManager: MKCoordinates of the current location, speed and course.

I want to make something like a Map application on iphone. When you are in route mode, and the route is drawn, as you move in your car, the blue dot no longer shows the estimated current location. Instead, it shows your movement along the drawn route (it never leaves the route line unless you cross a street that is not on the route). It's really cool. I don’t know how they do it.

Projecting to the closest point on the polyline does not work. Many times, the closest polyline to devices estimated the current location, rather than the polyline (street) you are on. But the Iphone Map application works very well. I am sure that they do not just design the nearest MKPolyline

+4
source share

Source: https://habr.com/ru/post/1415183/


All Articles