Search code examples
androidnavigationmapboxosrmmapbox-android

How to change Mapbox Polyline decoding precision to 5?


As I know Mapbox SDK (RouteUtils.java) uses precision of 6 to decode polyline and that affects Mapbox Navigation. When passing DiresctionsRoute with precision 6 to startNavigation(directionsRoute) every navigation listener works perfectly. But when adding DirectionsRoute with precision of 5 (as it's default precision from OSRM.V5). No listener works properly. How could I solve the problem.

NOTE: We're using OSRM.V5 in our server so it always returns route with precision of 5. And we aren't intended to use Mapbox's getRoute() as it's restricted at some point fro free users.


Solution

  • You can use geometries=polyline6 option in OSRM, but it requires 5.8.0 version

    Example http://router.project-osrm.org/route/v1/driving/13.388860,52.517037;13.397634,52.529407;13.428555,52.523219?overview=simplified&geometries=polyline6

    API reference http://project-osrm.org/docs/v5.7.0/api/#route-service