mapbox-navigation-android icon indicating copy to clipboard operation
mapbox-navigation-android copied to clipboard

Mapbox traffic layer data is not matching with Directions API response

Open Sridhar261990 opened this issue 3 years ago • 3 comments

Hi Team,

I am using mapbox dropInUi for my application. I was testing the traffic congestion and the gradient in the past few days. Initially I have tested the locations in Canada and now I have also tested for the USA. Based on the data-driven-lines(traffic layer) moderate and heavy congestion are available for the particular route. But When I check the directions response, I am only getting low and unknown congestion. Here, it looks like the API response is not matching with the traffic layer data. Because of this issue, I think the gradient for the moderate, heavy and severe congestion is not filling the color in the area where the traffic layer shows traffic data. For my testing I took the origin coordinates as 77.61243502079341,43.15548234143158 and destination is -77.56827,43.174277 and these are my results. It is applicable for most of the routes. I am not sure why traffic layer data is not matching with Directions API response. This is my API request - https://api.mapbox.com/directions/v5/mapbox/driving-traffic/-77.61243502079341%2C43.15548234143158%3B-77.56827%2C43.174277?alternatives=true&annotations=distance%2Cduration%2Cspeed%2Ccongestion&exclude=toll&geometries=polyline6&language=en&overview=full&steps=true&access_token=----------------------

jsonresponse.txt

Please check the Directions API response. It has only low and unknown congestions.

Screenshot_20220829-230928 mpaissue Screenshot_20220829-231022

com.mapbox.navigation:ui-dropin:2.8.0-alpha.3.

Steps to trigger behavior

  1. Try any original and destination coordinates in USA or Canada
  2. Draw the route line
  3. Start navigation

Traffic layer congestion should be filled with gradient congestion in the route line.

In current behavior the traffic layer data is not matching with directions API response congestions.

Sridhar261990 avatar Aug 30 '22 07:08 Sridhar261990

Here are a few more examples of the issue noted above, screen captures taken in Newmarket, Ontario, Canada.

mapbox.mapbox-traffic-v1

image image image image

EricGeiler avatar Aug 30 '22 11:08 EricGeiler

Support Ticket 129812 (Jinny) https://support.mapbox.com/hc/requests/129812

EricGeiler avatar Aug 31 '22 11:08 EricGeiler

traffic-v2-beta seems to have made this much better, however we are still seeing differences.

images below are with the v2 traffic data

Updated support ticket #130993 with @geografa at his request for additional information.

image image

Line on outside of roadway is styled line from traffic-v2-beta as per implemtation pdf exactly.

Our Route is build by using the following options;

RouteOptions.builder()
	.applyDefaultNavigationOptions()
	.applyLanguageAndVoiceUnitOptions(this.applicationContext)
	.coordinatesList(listOf(origin, destination))
	.alternatives(true)
	.baseUrl(Constants.BASE_API_URL)
	.user(Constants.MAPBOX_USER)
	.maxHeight(1.6)
	.maxWeight(2.5)
	.maxWidth(1.9)
	.snappingIncludeClosures(listOf(true, true)) // if you want both coordinates to be considered for snapping
	.snappingIncludeStaticClosures(listOf(true, true)) // if you want both coordinates to be considered for snapping
	.exclude(DirectionsCriteria.EXCLUDE_TOLL)
	.voiceInstructions(true)
	.bannerInstructions(true)
	.continueStraight(true)
	.alternatives(true)
	.annotationsList(annotations)
	.roundaboutExits(true)
	.overview("full")
	.steps(true)
	.build()

Route line fill is from the SDK pulling upon the annotations:congestion values to display the gradient using the following code.

MapboxRouteLineOptions.Builder(this)
            .withRouteLineResources(
                RouteLineResources.Builder()
                    .routeLineColorResources(
                        RouteLineColorResources.Builder()
                            .routeModerateCongestionColor(
                                ContextCompat.getColor(
                                    this@GpsActivity,
                                    R.color.moderate_congestion
                                )
                            )
                            .routeHeavyCongestionColor(
                                ContextCompat.getColor(
                                    this@GpsActivity,
                                    R.color.heavy_congestion
                                )
                            )
                            .routeSevereCongestionColor(
                                ContextCompat.getColor(
                                    this@GpsActivity,
                                    R.color.severe_congestion
                                )
                            )
                            .build()
                    )
                    .build()
            )
            .withVanishingRouteLineEnabled(true)
            .displayRestrictedRoadSections(true)
            .displaySoftGradientForTraffic(true)
            .softGradientTransition(40)
            .build()

EricGeiler avatar Sep 27 '22 19:09 EricGeiler

FYI... still seeing this issue present in drop-in UI 2.9.2

EricGeiler avatar Nov 24 '22 19:11 EricGeiler

FYI issue still present in 2.10.0-rc1 using Drop In UI.

EricGeiler avatar Jan 04 '23 12:01 EricGeiler

Issue still present in 2.10.1 using Drop In UI as a work around, we have removed the outside line coloring, and we have just kept the filled gradient.

EricGeiler avatar Feb 10 '23 12:02 EricGeiler