You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There’s an issue with the navigation SDK’s integration with custom styles built using style components in Studio.
Background
Here’s how the current road name feature works: in response to each user location update, the navigation SDK queries the currently visible vector tiles for the features at the coordinate at the current user location. It figures out which of the returned features is the road corresponding to the road that the user is on, then fashions a label with a name and shield image based on that feature’s properties.
The name comes from the feature’s {name} property, while the shield image is the style image (sprite) with a name in the format {shield}-{reflen}, based on the {shield} and {reflen} properties. The image and name are placed into an attributed string, then that attributed string goes into a UILabel for display.
Diagnosis
Shield icons in the Navigation Guidance Day v4 style’s sprite sheet are sized for display:
By contrast, shield icons in a custom style’s sprite sheet are much larger:
At the original scale, the icons in the custom style’s sprite sheet would be too large to comfortably display in the label. On the map, however, the icons appear roughly the same size because of the icon-size property in the style JSON:
In the custom style, the road-number-shield-navigation layer has icon-size set to an exponential interpolation expression with stops at 0.5 at z13 and at 1 at z22.
In Navigation Guidance Day v4, the road-shields-white and road-shields-black layers have icon-size set to a function (interpreted as a linear interpolation expression) with stops at 0.75 at z6 and 1 at z11.
#1576 assumes the style image is at full size and can be displayed without any downscaling. This is apparently no longer the case when it comes to styles created in Studio, now that style components have landed.
Affected customers
Any customer who creates a custom map style in Studio is affected. More likely than not, a customer who develops against the iOS navigation SDK will choose the Navigation template, which comes with these jumbo sprites by default.
Customers who are content with the v4 navigation styles are unaffected, because the sprites are the right size to begin with.
Next steps
As a failsafe, RoadNameLabelAttachment.getter:compositeImage should constrain the image size when calling UIImage.insert(text:color:font:atPoint:scale:) to something more reasonable, perhaps 1.2 times the attributed string’s paragraph style’s line height.
1ec5
changed the title
Custom style causes waypoint label to be mis-sized
Custom map style makes current road name label is too tall, route shield is too big
Apr 8, 2020
1ec5
changed the title
Custom map style makes current road name label is too tall, route shield is too big
Custom map style makes current road name label too tall, route shield too big
Apr 8, 2020
When using a custom style, the way name can apparently become enlarged, which is undesirable.
Investigate and fix.
/cc @mapbox/navigation-ios
The text was updated successfully, but these errors were encountered: