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 addImage(identifier: String, image: Bitmap, options: MTAddImageOptions? = null)

Registers an image asset that can be referenced from the style.

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.

fun addSprite(identifier: String, url: URL)

Registers a sprite hosted at the provided URL under the given identifier.

open override fun addTextPopup(popup: MTTextPopup)

Adds a text popup to the map.

Access to the collection of built-in color ramps.

Creates a color ramp from an array definition.

suspend fun createColorRamp(options: MTColorRampOptions = MTColorRampOptions()): MTColorRamp

Creates a custom color ramp.

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. Defaults to MTProjectionType.MERCATOR when unavailable.

Returns variants for the current reference style if they exist.

Returns variants for the provided reference style if they exist.

Returns a helper instance for adding heatmap layers.

suspend fun isSourceLoaded(sourceId: String): Boolean

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

Starts playback for a video source by its identifier.

Returns a helper instance for adding point layers.

Returns a helper instance for adding polygon layers.

Returns a helper instance for adding polyline layers.

fun removeLayer(layer: MTLayer)

Removes a layer from the map.

fun removeLayerById(layerId: String)

Removes a layer by its identifier if present.

open override fun removeMarker(marker: MTMarker)

Removes the marker from the map.

fun removeSource(source: MTSource)

Removes a source from the map.

fun removeSourceById(sourceId: String)

Removes a source by its identifier if present.

open override fun removeTextPopup(popup: MTTextPopup)

Removes a text popup from the map.

fun MTStyle.setCircleColorStep(layerId: String, key: MTFeatureKey = MTFeatureKey.POINT_COUNT, defaultColor: Int, stops: List<Pair<Double, Int>>, includeAlpha: Boolean = false)
suspend fun MTStyle.setCircleColorStepAwait(layerId: String, key: MTFeatureKey = MTFeatureKey.POINT_COUNT, defaultColor: Int, stops: List<Pair<Double, Int>>, includeAlpha: Boolean = false)
fun MTStyle.setCircleRadiusStep(layerId: String, key: MTFeatureKey = MTFeatureKey.POINT_COUNT, defaultRadius: Double, stops: List<Pair<Double, Double>>)

Typed convenience helpers for common clustering styling patterns.

suspend fun MTStyle.setCircleRadiusStepAwait(layerId: String, key: MTFeatureKey = MTFeatureKey.POINT_COUNT, defaultRadius: Double, stops: List<Pair<Double, Double>>)
fun setFilter(layerId: String, filter: PropertyValue)
suspend fun setFilterAwait(layerId: String, filter: PropertyValue)
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.

Sets the map secondary language.

fun setSky(sky: MTSky)

Sets the sky appearance (colors, blends, or expressions). Any field not explicitly provided keeps its previous value.

fun setSpace(space: MTSpace)

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

fun setSprite(spriteUrl: String)

Updates the sprite of the map.

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

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

suspend fun MTStyle.setTextSizeAwait(layerId: String, size: Double)

Stops (pauses) playback for a video source by its identifier.

fun updateImage(identifier: String, image: Bitmap)

Updates an image with the given identifier.