MTStyle

class MTStyle(reference: MTMapReferenceStyle, variant: MTMapStyleVariant? = null) : MTStylable

The proxy object for the current map style.

Set of convenience methods for style, sources and layers manipulation. MTStyle is null until map loading is complete.

Constructors

constructor(reference: MTMapReferenceStyle, variant: MTMapStyleVariant? = null)

Properties

Current reference style of the map object.

Current style variant of the map object.

Functions

fun addLayer(layer: MTLayer)

Adds a layer to the map.

Adds the MapTiler logo control to the map.

open override fun addMarker(marker: MTMarker)

Adds the marker to the map.

fun addSource(source: MTSource)

Adds a source to the map.

open override fun addTextPopup(popup: MTTextPopup)

Adds a text popup to the map.

Disables halo (animates out).

Disables halo state transitions (animations).

Disables space state transitions (animations).

Disables the 3D terrain visualization.

Enables the globe projection visualization.

Enables halo with default gradient.

Enables the mercator projection visualization.

fun enableTerrain(exaggerationFactor: Double? = null)

Enables the 3D terrain visualization.

Returns SDK style id for a given reference style.

Returns SDK style id for a given style variant.

Returns display name for a given reference style.

Returns display name for a given style variant.

Gets the current projection type if set.

Returns variants for the current reference style if they exist.

Returns variants for the provided reference style if they exist.

suspend fun isSourceLoaded(sourceId: String): Boolean

Returns boolean value indicating whether the source with provided id is loaded.

fun removeLayer(layer: MTLayer)

Removes a layer from the map.

open override fun removeMarker(marker: MTMarker)

Removes the marker from the map.

fun removeSource(source: MTSource)

Removes a source from the map.

open override fun removeTextPopup(popup: MTTextPopup)

Removes a text popup from the map.

fun setGlyphs(url: URL)

Sets the glyphs URL template.

fun setHalo(halo: MTHalo)

Sets the atmospheric halo (glow) configuration on the globe.

fun setLanguage(language: MTLanguage)

Sets the map language.

fun setLight(lightOptionsJson: String)

Sets the global light options for the current style. Provide a JSON object string compatible with MapLibre GL Light specification. Example: { "anchor": "viewport", "intensity": 0.5 }

fun setRenderWorldCopies(shouldRenderWorldCopies: Boolean)

Sets whether world copies should render.

fun setSpace(space: MTSpace)

Sets the globe space background (deep space/skybox). Any field not explicitly provided keeps its previous value.

fun setStyle(reference: MTMapReferenceStyle, variant: MTMapStyleVariant? = null)

Sets the current style by reference style and optional variant. Changing the style resets sources and layers.