Open hardikJoshi123 opened 4 years ago
I got some success. By setting up hardcoded geometry() to my custom DirectionsRoute object, it shows route on map. Not sure is there specific format for geometry string?
#1 SETTING HARD CODED geometry() its working fine :
geometry=gxxlu@zqfzC}[VwEDqB@iCAQbHD
OBxFBpB@lABvB?zME~FSzJkD@sJBcHR}ERsE^cD\yFp@gFr@{GrAcDt@eDr@gFdA_Fx@mFp@gGh@iCNaDHNHgf@J}B@iCDqMT{T^{DFBsDNg@BmEAqAGkBOgCQiAS_AYmAWiAQqAG}@~B?
#2 THIS IS WHAT WE HAVE for geometry(), but it doesn't show route on map :
geometry=}wdmDzpuoNwB@?GO?M??H?bB?hCkABiAH}@NcBZg@D_A@kC@kCF?oBAu@Ic@AS
I am creating custom DirectionRoute object and passing it to NavigationMapRoute by using :
navigationMapRoute!!.addRoute(currentRoute)
But it doesn't show the route on map. Is there any error handler which we can implement to figure out what causing issue and which specific parameter is wrong?
Android API:
Mapbox Navigation SDK version: implementation ('com.mapbox.mapboxsdk:mapbox-android-navigation-ui:0.40.0')
Steps to trigger behavior
Creating custom DirectionRoute object like this :
DirectionsRoute.builder() .distance(route.totalDistance.toDouble()) .duration(route.totalDuration.toDouble()) .geometry(route.overviewPolyline.rawPointList) .weightName("routability") .voiceLanguage("en-US") .legs(buildLeg(route.legList)) .weight(0.0) .routeOptions(RouteOptions.builder().baseUrl("https://api.mapbox.com") .user("mapbox") .profile("driving-traffic") .accessToken("pk.-------------MY KEY----------") .requestUuid("ckg0fffmi00495xpauhg885pm") .geometries(DirectionsCriteria.GEOMETRY_POLYLINE6) .coordinates(pointList) .continueStraight(true) .roundaboutExits(true) .overview(DirectionsCriteria.OVERVIEW_FULL) .steps(true) .voiceInstructions(true) .bannerInstructions(true) .voiceUnits("metric") .language("en") .annotations("congestion,distance") .build()) .build()
Passing this custom DirectionRoute object to NavigationMapRoute :
navigationMapRoute!!.addRoute(currentRoute)
Expected behavior
Display route on map
Actual behavior
Route doesn't show