Missing Glyphs for highways, parks, etc

In the iOS SDK, I can’t get shields to show up on the map. I previously used the default style but it didn’t work. I switched to a custom style where I am sure that has Shields (attached screenshot below from TomTom Map Styler and from the app). Even when I zoom in, the icons for parks, subway stations etc. are all missing. Any help would really be appreciated.

Hey,
to add the shields you have to define TTMapStyleDefaultConfiguration style, and pass it through TTMapConfiguration to the TTMapView constructor.

The map initialization looks like this:

let style = TTMapStyleDefaultConfiguration()
let mapConfig = TTMapConfigurationBuilder.create().withMapKey("YOUR_API_KEY")
            .withMapStyleConfiguration(style)
            .build()
self.mapView = TTMapView(frame: self.view.frame, mapConfiguration: mapConfig)
self.view.addSubview(self.mapView)
2 Likes

I already had the DefaultConfiguration added and the shields are still missing in a custom style, so are the park etc. icons.

Could you add your code snippet, it will be easier to help?

1 Like
let style = TTMapStyleDefaultConfiguration()
let config =
           TTMapConfigurationBuilder
                .create()
                .withMapKey(AppDelegate.TomTomKey)
                .withTrafficKey(AppDelegate.TomTomKey)
                .withMapStyleConfiguration(style)
                .withTomTomLogoPosition(.init(verticalPosition: .bottom, horizontalPosition: .left, verticalOffset: -22, horizontalOffset: 10))
                .build()
            
let mapView = TTMapView(mapConfiguration: config)

Then I apply the style as follows when the map is ready

let configuration = TTMapStyleConfigurationBuilder.create(withStyleURL: "asset://../../defaultStyle.json").build()
mapView.styleManager.load(configuration, withCompletion: nil)

I also tried giving the custom style in the TTMapConfigurationBuilder but I had no luck with it. I also realized chevron tracking is not working a custom style as well. No matter how many updates I’ll push to the chevron it gets stuck at the initial location.

Created style using Map Styler | Map Display API | TomTom Developer Portal has to be added to the project in the Xcode. Then add it to the map in the following way, shields and icons should be normally visible.

let mapConfig = TTMapConfigurationBuilder.create()
     .withMapKey("YOUR_API_KEY")
     .withTomTomLogoPosition(.init(verticalPosition: .bottom, horizontalPosition: .left, verticalOffset: -22, horizontalOffset: 10))
            .build()
self.mapView = TTMapView(frame: self.view.frame, mapConfiguration: mapConfig)
let customStyle = Bundle.main.path(forResource: "custom_style", ofType: "json")
mapView.setStylePath(customStyle)
self.view.addSubview(self.mapView)

The first answer also works for shields if you want a default style of the map, you do not have to do anything in the onMapReady method if you define style when the map is configured.


Just added the style as you suggested, and it looks like that fixed the chevron issue.

However, I still don’t have any badges appearing. I assume at this point something is wrong with the export I am getting from the website but I can’t tell what, since badges do appear in the web preview. For reference, I am trying to export the default map that comes up when I open the Map Styler. Just wanted to see how things work before designing the map.

I’m also following the instructions using convertStyle.py to convert the style for SDK usage. (from here Custom style | Map, Documentation | Maps SDK for iOS | TomTom Developer Portal)

You can check your custom style JSON file if paths to sprites and glyphs are valid.