I have been using MapBox draw a map and the user position on the said map. At the same time using the location engine, I'm subscribing to location changes. The problem with location changes is that they happens once per second (at most) and my users mostly drive, so the recorded locations are pretty much often behind.
I realized that even the locations logged are behind, the marker showing the user's current location seems to always be accurate. I'm wondering if there is a possibility to get the "estimated" location of the current position marker.
Also according to the documentation from mapbox, I can get more accurate locations (more frequent as well) using the ProgressChangeListener. I tried setting up this way but it didn't work.
val nav = MapboxNavigation(this,getString(R.string.access_token))
nav.addProgressChangeListener { location, routeProgress ->
Timber.tag("GPSDEBUG").d("GOT LOC UPDATE on ${System.currentTimeMillis()} with ${location.longitude},${location.latitude}")
}
nav.startNavigation(DirectionsRoute.fromJson(""))
Obviously MapBox didn't like to have an empty road or a fake navigation.
I would be great to have a feedback on this before I try other suggestions such as using a Kalman algorithm to "estimate" the missing locations.
ULTIMATELY: The main goal is to retrieve accurate GPS coordinates even at high speed.
from Get the location of the position marker using MapBox
No comments:
Post a Comment