Custom Map Styles

The HERE SDK for Android provides a flexible solution to customize the map by loading custom map schemes.

If you are looking for predefined map styles, see the Quick Start guide for an introduction. The HERE SDK already includes a set of pre-configured map styles such as .normalDay or .satellite.

Create and Load Custom Map Styles

The most flexible solution to customize the map is to create your own map styles using a configuration file generated with the WYSIWYG HERE Style Editor.

To access the HERE Style Editor, please contact your HERE representative - as the editor is not yet publicly available. Please note that the resulting map styles are not compatible with the web editor, so only the HERE Style Editor can be used with the HERE SDK. This HERE SDK release is compatible with the HERE Style Editor 0.26. It is recommended to use the latest style editor and to update existing styles in case of unexpected behavior or errors.

As soon as you are satisfied with your custom map style, add the generated folder via Xcode's Project navigator. Make sure to adapt the path to your Bundle resources and load the style into a map scene as follows:

private func loadCustomMapStyle() {
let bundle = Bundle(for: ViewController.self)
let yamlResourceUrl = bundle.url(forResource: "mymapstyle.scene",
withExtension: "json",
subdirectory: "MyData/style")
guard let jsonResourceString = yamlResourceUrl?.absoluteString else {
return
}

// Load the map scene using the JSON resource.
}

guard mapError == nil else {
print("Error: Map scene not loaded, \(String(describing: mapError))")
return
}

// Configure the map.
let camera = mapView.camera
camera.lookAt(point: GeoCoordinates(latitude: 52.518043, longitude: 13.405991),
distanceInMeters: 1000 * 10)
}


In the above snippet, we verify that the mymapstyle.scene.json file exists at the expected location. You only have to load this file. From there, the HERE SDK will find the other files - as exported from the editor. Make sure that all style files are kept together at the same folder level. mymapstyle.scene.json is the main file that includes references to the other files. mymapstyle is the name of your custom map style.

Using custom map styles can be very effective to differentiate your app from other map applications. In addition, it is possible to change map styles on-the-fly, for example, to shift the user's attention to certain map elements based on the current state of your app.