-
Notifications
You must be signed in to change notification settings - Fork 315
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Road and POI labels text cannot display when switch endpoint to .cn #1554
Comments
I was unaware that China Streets differs from the rest-of-world Streets source in this way. Are there any other differences that we should be aware of? The navigation SDK makes a lot of assumptions about the Streets source’s fields and layers. For this particular issue, we should introduce a special case in the map SDK that varies these lists of locale identifiers for the .cn API endpoint. The fix will complicate mapbox/mapbox-gl-native#11867 a bit, but I think that’s OK. Would you mind opening an issue about this, along with a link to the public documentation for this source, if it’s available? Thanks! |
Yes, we should track this issue in mapbox-gl-native, since a proper fix would go into the map SDK. In the meantime, we can also work around the issue in the navigaiton SDK. The code below currently uses the mapbox-navigation-ios/MapboxNavigation/NavigationMapView.swift Lines 971 to 972 in e5f3715
|
After thinking of our navigation SDK for supporting .cn map, and I think there should be a .cn network module like our map SDK(Refer to MGLNetworkConfiguration.h & MGLNetworkConfiguration.m). It can make our SDK much easier to switch the endpoint: not only the map endpoint, also the api-direction, tts services endpoint. For deep diving into mgl_expressionLocalizedIntoLocale function in our map SDK, I think it's better to do nothing in localizeLabels function when the map is switch the endpoint to .cn. |
mapbox/mapbox-gl-native#12387 introduces a fallback from |
Issue fixed and closed |
Now I'm focus on navigation project inside China by using our navigation-ios SDK. When I switch the endpoint to .cn, all the roads and POI labels text cannot display:
After deep dive into this bug, I found that during the
func mapView(_ mapView: MGLMapView, didFinishLoading style: MGLStyle)
function inNavigationMapView.swift
, our navigation SDK do a localized logic calledself.mapView.localizeLabels()
.In this function, I saw a couple of lines code:
This function make the labels can be localized to the phone's region & language.
However, in .cn map, layers' properties is a little bit different from global side:
China layers sample:
This is our global layer properties' link.
As you see, the layer's from .cn only have the
name_zh
but intext.mgl_expressionLocalized(into: locale)
, it return thename_zh-Hans
. I know this function is in our map SDK but I'm not very sure it should be fixed on client side or server side.After talking with @zmofei, he said the .cn data is directly provided by EMG and it's hard to modify in a short term, so I think fix on client side is a better choice. Should we do some downgrade strategy if our layers do not contain
name_zh-Hans
property? @1ec5 @bsudekumOur map SDK do not have this problem and it can read these properties well because it seems that call not the localized function. So if we need to fix on client side, it's better to fix in our map SDK not in navigation SDK.
cc: @chriswu42 @tony-cj
The text was updated successfully, but these errors were encountered: