THIS SDK ISDEPRECATED.

We rolled out a new and better SDK for you.

Map Styles Extensions

The TomTom Maps SDK gives you the ability to use either online or offline styles in your mobile application.

  • If you choose to use offline styles, they will be imported to your app with the Maps SDK package. Thanks to that, the styles will already be included in your app at download time. The styles are added to the Maps SDK package by default.
  • If you choose to use online styles, they will be downloaded into your application when the map is displayed for the first time. Thanks to that, your mobile app size is smaller at the app’s download time so your app downloadable is lighter. In this case you need to exclude offline styles from the SDK.

Offline styles

To use the offline style framework, no actions are required because offline styles are attached to the map by default. To use the offline style library, no actions are required because offline styles are attached to the map by default i.e. the offline style framework 'TomTomOnlineSDKMapsStyle' will be added automatically while fetching 'TomTomOnlineSDKMaps'.

pod 'TomTomOnlineSDKMaps'

If offline styles are not attached to the project, nor online style is setup for the map, a black screen will render in mapView.

Online styles

To exclude offline styles from the TomTomOnlineSDKMaps framework, use an exclude declaration when the TomTomOnlineSDKMaps framework is declared as shown in the following code example.

pod 'TomTomOnlineSDKMaps/Online'

When offline styles are excluded, the online styles should be set up.

1let mapStyleConfiguration = TTMapStyleDefaultConfiguration()
2let mapConfig = TTMapConfigurationBuilder.create().withMapStyleConfiguration(mapStyleConfiguration).build()
3let mapView = TTMapView(mapConfiguration: mapConfig)
1TTMapStyleDefaultConfiguration *style = [[TTMapStyleDefaultConfiguration alloc] init]
2TTMapConfiguration *config = [[[[[TTMapConfigurationBuilder createBuilder] withMapKey:Key.Map] withTrafficKey:Key.Traffic] withMapStyleConfiguration:style] build];
3TTMapView *mapView = [[TTMapView alloc] initWithMapConfiguration:config];

self.view = mapView; self.mapView = mapView;

You can set up online styles in TTMapView:

1let mapStyleConfiguration = TTMapStyleConfiguration(styleURL: "<style json>")
2let mapConfig = TTMapConfigurationBuilder.create().withMapStyleConfiguration(mapStyleConfiguration).build()
3let mapView = TTMapView(mapConfiguration: mapConfig)
TTMapStyleConfiguration *mapStyleConfiguration = [[TTMapStyleConfiguration alloc] initWithStyleURL:@"<style json>"]; TTMapConfiguration *mapConfig = [[[TTMapConfigurationBuilder createBuilder] withMapStyleConfiguration:mapStyleConfiguration] build];
TTMapView *mapView = [[TTMapView alloc] initWithMapConfiguration:mapConfig];

Styling from source

You can use your offline style files in a similar manner to online hosted ones. You need just to pass a file path to the JSON file in your project as styleUrl.

If you want to use style.json located in the main project catalog, use: "asset://../../style.json"