Apply Custom Map Style
In this guide you will learn how to render an interactive map, and change the map style by applying a custom map style edited with, and downloaded from, the online editor.
The map is fully 3D, supporting pan, pinch-zoom, pinch-rotate and tilt.
Map Implementation
A map style, previously edited in the online editor and then downloaded, is in the assets
folder of this example project.
This function opens the file, reads it, and if it is not empty, sets the map style using the style file data just read: mapView?.preferences?.setMapStyleByDataBuffer(DataBuffer(data))
.
MainActivity
overrides the onCreate
function, which checks that internet access is available, and then, when the map is ready, that is, loaded and initialized, automatically applies the custom map style stored in this example project’s assets
folder: applyCustomAssetStyle(gemSurfaceView.mapView)