mapbox / mapbox/mapbox-navigation-android

Route doesn't show on map for custom DirectionRoute

Open
#3,637 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Kotlin
Stars
651
Forks
321
PR merge metrics
No merged PRs in 30d

Description

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

1. 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()

2. Passing this custom DirectionRoute object to NavigationMapRoute :

navigationMapRoute!!.addRoute(currentRoute)

3. It doesn't show route on map. Is there any listener which will tell us the problem?

### Expected behavior
Display route on map

### Actual behavior
Route doesn't show

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at NavigationMapRoute.addRoute and inspect how SDK 0.40.0 consumes the custom DirectionsRoute built in the issue. Compare the supplied geometry, legs, and route options with the route data expected by that entry point, then look for any available error reporting. Done means identifying the invalid or missing input and making the route display on the map.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.