MapboxMap

The general class to interact with in the Mapbox Maps SDK for Android. It exposes the entry point for all methods related to the Map object. You cannot instantiate MapboxMap object directly, rather, you must obtain one from the getMapboxMap() method MapView that you have added to your application.

Note: Similar to a View object, a MapboxMap should only be read and modified from the main thread.

Types

Link copied to clipboard
object Companion

A convenience object to access MapboxMap's static utilities.

Functions

Link copied to clipboard
open fun addGeoJSONSourceFeatures(sourceId: String, dataId: String, features: List<Feature>): Expected<String, None>
Link copied to clipboard
fun addImage(imageId: String, bitmap: Bitmap): Expected<String, None>
fun addImage(imageId: String, image: Image): Expected<String, None>
fun addImage(imageId: String, bitmap: Bitmap, sdf: Boolean): Expected<String, None>
fun addImage(imageId: String, image: Image, sdf: Boolean): Expected<String, None>
Link copied to clipboard
open override fun addOnCameraChangeListener(onCameraChangeListener: OnCameraChangeListener)

Add a listener that's going to be invoked whenever map camera changes.

Link copied to clipboard
open override fun addOnMapIdleListener(onMapIdleListener: OnMapIdleListener)

Add a listener that's going to be invoked whenever map has entered the idle state.

Link copied to clipboard
open override fun addOnMapLoadedListener(onMapLoadedListener: OnMapLoadedListener)

Add a listener that's going to be invoked whenever the Map's style has been fully loaded, and the Map has rendered all visible tiles.

Link copied to clipboard
open override fun addOnMapLoadErrorListener(onMapLoadErrorListener: OnMapLoadErrorListener)

Add a listener that's going to be invoked whenever there's a map load error.

Link copied to clipboard
open override fun addOnRenderFrameFinishedListener(onRenderFrameFinishedListener: OnRenderFrameFinishedListener)

Add a listener that's going to be invoked whenever the Map finished rendering a frame.

Link copied to clipboard
open override fun addOnRenderFrameStartedListener(onRenderFrameStartedListener: OnRenderFrameStartedListener)

Add a listener that's going to be invoked whenever the Map started rendering a frame.

Link copied to clipboard
open override fun addOnSourceAddedListener(onSourceAddedListener: OnSourceAddedListener)

Add a listener that's going to be invoked whenever a source has been added with StyleManager#addStyleSource runtime API.

Link copied to clipboard
open override fun addOnSourceDataLoadedListener(onSourceDataLoadedListener: OnSourceDataLoadedListener)

Add a listener that's going to be invoked whenever the source data has been loaded.

Link copied to clipboard
open override fun addOnSourceRemovedListener(onSourceRemovedListener: OnSourceRemovedListener)

Add a listener that's going to be invoked whenever a source has been removed with StyleManager#removeStyleSource runtime API.

Link copied to clipboard
open override fun addOnStyleDataLoadedListener(onStyleDataLoadedListener: OnStyleDataLoadedListener)

Add a listener that's going to be invoked whenever the requested style data been loaded. The 'type' property defines what kind of style data has been loaded.

Link copied to clipboard
open override fun addOnStyleImageMissingListener(onStyleImageMissingListener: OnStyleImageMissingListener)

Add a listener that's going to be invoked whenever a style has a missing image.

Link copied to clipboard
open override fun addOnStyleImageUnusedListener(onStyleImageUnusedListener: OnStyleImageUnusedListener)

Add a listener that's going to be invoked whenever an image added to the Style is no longer needed and can be removed using StyleManager#removeStyleImage method.

Link copied to clipboard
open override fun addOnStyleLoadedListener(onStyleLoadedListener: OnStyleLoadedListener)

Add a listener that's going to be invoked whenever the requested style has been fully loaded, including the style specified sprite and sources.

Link copied to clipboard
open fun addPersistentStyleCustomLayer(layerId: String, layerHost: CustomLayerHost, layerPosition: LayerPosition?): Expected<String, None>
Link copied to clipboard
open fun addPersistentStyleLayer(properties: Value, layerPosition: LayerPosition?): Expected<String, None>
Link copied to clipboard
open fun addStyleCustomLayer(layerId: String, layerHost: CustomLayerHost, layerPosition: LayerPosition?): Expected<String, None>
Link copied to clipboard
open fun addStyleImage(imageId: String, scale: Float, image: Image, sdf: Boolean, stretchX: List<ImageStretches>, stretchY: List<ImageStretches>, content: ImageContent?): Expected<String, None>
Link copied to clipboard
open fun addStyleImportFromJSON(importId: String, json: String, config: HashMap<String, Value>?, importPosition: ImportPosition?): Expected<String, None>
Link copied to clipboard
open fun addStyleImportFromURI(importId: String, uri: String, config: HashMap<String, Value>?, importPosition: ImportPosition?): Expected<String, None>
Link copied to clipboard
open fun addStyleLayer(parameters: Value, position: LayerPosition?): Expected<String, None>
Link copied to clipboard
open fun addStyleModel(modelId: String, modelUri: String): Expected<String, None>
Link copied to clipboard
open fun addStyleSource(sourceId: String, properties: Value): Expected<String, None>
Link copied to clipboard
open override fun cameraAnimationsPlugin(function: CameraAnimationsPlugin.() -> Any?): Any?

Call extension function on CameraAnimationsPlugin. In most cases should not be called directly.

Link copied to clipboard
open override fun cameraForCoordinateBounds(bounds: CoordinateBounds, boundsPadding: EdgeInsets?, bearing: Double?, pitch: Double?, maxZoom: Double?, offset: ScreenCoordinate?): CameraOptions

Convert the given bounds, boundsPadding, bearing and pitch values to CameraOptions. Note that this method takes into account the current map padding in addition to the boundsPadding provided in parameters.

Link copied to clipboard
open override fun cameraForCoordinates(coordinates: List<Point>, camera: CameraOptions, box: ScreenBox): CameraOptions

Convenience method that adjusts the provided CameraOptions object for given parameters.

open override fun cameraForCoordinates(coordinates: List<Point>, coordinatesPadding: EdgeInsets?, bearing: Double?, pitch: Double?): CameraOptions

Convenience method that returns the CameraOptions object for given parameters. This method takes into account the current map padding in addition to the padding provided in parameters.

open override fun cameraForCoordinates(coordinates: List<Point>, camera: CameraOptions, coordinatesPadding: EdgeInsets?, maxZoom: Double?, offset: ScreenCoordinate?): CameraOptions
open override fun cameraForCoordinates(coordinates: List<Point>, camera: CameraOptions, coordinatesPadding: EdgeInsets?, maxZoom: Double?, offset: ScreenCoordinate?, result: (CameraOptions) -> Unit)

Convenience method that returns the CameraOptions object for given parameters.

Link copied to clipboard
open override fun cameraForDrag(fromPoint: ScreenCoordinate, toPoint: ScreenCoordinate): CameraOptions

Calculates a target point where the camera should move after dragging from a screen coordinate startCoordinate to another coordinate endCoordinate.

Link copied to clipboard
open override fun cameraForGeometry(geometry: Geometry, geometryPadding: EdgeInsets?, bearing: Double?, pitch: Double?): CameraOptions

Convert the given geometry, geometryPadding, bearing and pitch values to CameraOptions. Note that this method takes into account the current map padding in addition to the geometryPadding provided in parameters.

Link copied to clipboard

Returns the CoordinateBounds for a given camera.

Link copied to clipboard

Returns the CoordinateBounds for a given camera.

Link copied to clipboard

Returns the CoordinateBounds for given RectF defined in screen points.

Link copied to clipboard

Returns the coordinate bounds and zoom for a given camera.

Link copied to clipboard

Returns the unwrapped coordinate bounds and zoom for a given camera.

Link copied to clipboard
open override fun coordinateForPixel(pixel: ScreenCoordinate): Point

Calculate a geographical coordinate(i.e., longitude-latitude pair) that corresponds to a screen coordinate.

Link copied to clipboard
open override fun coordinateForProjectedMeters(projectedMeters: ProjectedMeters): Point

Calculate a longitude-latitude pair for a Spherical Mercator projected meters.

Link copied to clipboard

Calculates the geographical coordinate information that corresponds to a given screen coordinate.

Link copied to clipboard
open override fun coordinatesForPixels(pixels: List<ScreenCoordinate>): List<Point>

Calculate geographical coordinates(i.e., longitude-latitude pair) that corresponds to screen coordinates.

Link copied to clipboard

Calculates the geographical coordinates information that corresponds to the given screen coordinates.

Link copied to clipboard
open override fun executeOnRenderThread(runnable: Runnable)

In some cases querying source / render features is expected to be a blocking operation e.g. performing this action on map click. In this case in order to avoid deadlock on main thread querying could be performed on render thread and in that case querying result will be also delivered on render thread not leading to the main thread deadlock. Example:

Link copied to clipboard
open override fun gesturesPlugin(function: GesturesPlugin.() -> Any?): Any?

Call extension function on GesturesPlugin. In most cases should not be called directly.

Link copied to clipboard

Returns attributions for the data used by the Map's style.

Link copied to clipboard
open override fun getBounds(): CameraBounds

Get the map bounds options.

Link copied to clipboard
Link copied to clipboard

Get debug options

Link copied to clipboard
fun getElevation(coordinate: Point): Double?

Get elevation for given coordinate. Value is available only for the visible region on the screen, if terrain (DEM) tile is available.

Link copied to clipboard
fun getFeatureState(sourceId: String, sourceLayerId: String? = null, featureId: String, callback: QueryFeatureStateCallback): Cancelable

Get the state map of a feature within a style source.

Link copied to clipboard

Get the map's current free camera options. After mutation, it should be set back to the map.

Link copied to clipboard
fun getGeoJsonClusterChildren(sourceIdentifier: String, cluster: Feature, callback: QueryFeatureExtensionCallback): Cancelable

Returns the children (original points or clusters) of a cluster (on the next zoom level) given its id (cluster_id value from feature properties) from a GeoJsonSource.

Link copied to clipboard
fun getGeoJsonClusterExpansionZoom(sourceIdentifier: String, cluster: Feature, callback: QueryFeatureExtensionCallback): Cancelable

Returns the zoom on which the cluster expands into several children (useful for "click to zoom" feature) given the cluster's cluster_id (cluster_id value from feature properties) from a GeoJsonSource.

Link copied to clipboard
fun getGeoJsonClusterLeaves(sourceIdentifier: String, cluster: Feature, limit: Long = QFE_DEFAULT_LIMIT, offset: Long = QFE_DEFAULT_OFFSET, callback: QueryFeatureExtensionCallback): Cancelable

Returns all the leaves (original points) of a cluster (given its cluster_id) from a GeoJsonSource, with pagination support: limit is the number of leaves to return (set to Infinity for all points), and offset is the amount of points to skip (for pagination).

Link copied to clipboard
open override fun getMapOptions(): MapOptions

Get map options.

Link copied to clipboard
open override fun getMetersPerPixelAtLatitude(latitude: Double): Double

Calculate distance spanned by one pixel at the specified latitude at current zoom level.

open override fun getMetersPerPixelAtLatitude(latitude: Double, zoom: Double): Double

Calculate distance spanned by one pixel at the specified latitude and zoom level.

Link copied to clipboard

Get the prefetch zoom delta

Link copied to clipboard

Returns whether multiple copies of the world are being rendered side by side beyond -180 and 180 degrees longitude.

Link copied to clipboard
open override fun getSize(): Size

Gets the size of the map.

Link copied to clipboard
@JvmName(name = "getStyleDeprecated")
fun getStyle(): Style?

Get the Style of the map synchronously, will return null is style is not loaded yet.

fun getStyle(onStyleLoaded: Style.OnStyleLoaded)

Get the Style of the map asynchronously.

Link copied to clipboard
Link copied to clipboard
open fun getStyleImage(imageId: String): Image?
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun getStyleLayerProperty(layerId: String, property: String): StylePropertyValue
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun getStyleSourceProperty(sourceId: String, property: String): StylePropertyValue
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun hasStyleImage(imageId: String): Boolean
Link copied to clipboard
open fun hasStyleModel(modelId: String): Boolean
Link copied to clipboard
open override fun isGestureInProgress(): Boolean

Returns if a gesture is in progress.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open override fun isUserAnimationInProgress(): Boolean

Returns if user animation is currently in progress.

Link copied to clipboard

Whether the MapboxMap instance is valid.

Link copied to clipboard
fun loadStyle(styleExtension: StyleContract.StyleExtension, onStyleLoaded: Style.OnStyleLoaded? = null)

Loads the new map style built from the specified style DSL block. For example:

fun loadStyle(style: String, onStyleLoaded: Style.OnStyleLoaded? = null)

Loads the new map style either from a specified URI or from a JSON both represented as String.

fun loadStyle(styleExtension: StyleContract.StyleExtension, onStyleLoaded: Style.OnStyleLoaded? = null, onMapLoadErrorListener: OnMapLoadErrorListener? = null)
fun loadStyle(styleExtension: StyleContract.StyleExtension, styleTransitionOptions: TransitionOptions? = null, onStyleLoaded: Style.OnStyleLoaded? = null, onMapLoadErrorListener: OnMapLoadErrorListener? = null)

Legacy method to load style, please refer to deprecation message for more details.

Link copied to clipboard
fun loadStyleJson(styleJson: String)
fun loadStyleJson(styleJson: String, onStyleLoaded: Style.OnStyleLoaded)
fun loadStyleJson(styleJson: String, onStyleLoaded: Style.OnStyleLoaded? = null, onMapLoadErrorListener: OnMapLoadErrorListener? = null)
fun loadStyleJson(styleJson: String, styleTransitionOptions: TransitionOptions? = null, onStyleLoaded: Style.OnStyleLoaded? = null, onMapLoadErrorListener: OnMapLoadErrorListener? = null)

Legacy method to load style, please refer to deprecation message for more details.

Link copied to clipboard
fun loadStyleUri(styleUri: String)
fun loadStyleUri(styleUri: String, onStyleLoaded: Style.OnStyleLoaded)
fun loadStyleUri(styleUri: String, onStyleLoaded: Style.OnStyleLoaded? = null, onMapLoadErrorListener: OnMapLoadErrorListener? = null)
fun loadStyleUri(styleUri: String, styleTransitionOptions: TransitionOptions? = null, onStyleLoaded: Style.OnStyleLoaded? = null, onMapLoadErrorListener: OnMapLoadErrorListener? = null)

Legacy method to load style, please refer to deprecation message for more details.

Link copied to clipboard
open fun moveStyleImport(importId: String, importPosition: ImportPosition?): Expected<String, None>
Link copied to clipboard
open fun moveStyleLayer(layerId: String, layerPosition: LayerPosition?): Expected<String, None>
Link copied to clipboard
open override fun pixelForCoordinate(coordinate: Point): ScreenCoordinate

Calculate a screen coordinate that corresponds to a geographical coordinate (i.e., longitude-latitude pair).

Link copied to clipboard
open override fun pixelsForCoordinates(coordinates: List<Point>): List<ScreenCoordinate>

Calculate screen coordinates that corresponds to geographical coordinates (i.e., longitude-latitude pair).

Link copied to clipboard
open override fun project(point: Point, zoomScale: Double): MercatorCoordinate

Calculate a point on the map in Mercator Projection for a given coordinate at the specified zoom scale.

Link copied to clipboard
open override fun projectedMetersForCoordinate(point: Point): ProjectedMeters

Calculate Spherical Mercator ProjectedMeters coordinates.

Link copied to clipboard

Queries the map for rendered features.

Link copied to clipboard
open override fun querySourceFeatures(sourceId: String, options: SourceQueryOptions, callback: QuerySourceFeaturesCallback): Cancelable

Queries the map for source features.

Link copied to clipboard

Reduce memory use. Useful to call when the application gets paused or sent to background.

Link copied to clipboard
fun removeFeatureState(sourceId: String, sourceLayerId: String? = null, featureId: String, stateKey: String? = null, callback: FeatureStateOperationCallback): Cancelable

Removes entries from a feature state object.

Link copied to clipboard
open fun removeGeoJSONSourceFeatures(sourceId: String, dataId: String, featureIds: List<String>): Expected<String, None>
Link copied to clipboard
open override fun removeOnCameraChangeListener(onCameraChangeListener: OnCameraChangeListener)

Remove the camera change listener.

Link copied to clipboard
open override fun removeOnMapIdleListener(onMapIdleListener: OnMapIdleListener)

Remove the map idle listener.

Link copied to clipboard
open override fun removeOnMapLoadedListener(onMapLoadedListener: OnMapLoadedListener)

Remove the map loaded listener.

Link copied to clipboard
open override fun removeOnMapLoadErrorListener(onMapLoadErrorListener: OnMapLoadErrorListener)

Remove the map error listener.

Link copied to clipboard
open override fun removeOnRenderFrameFinishedListener(onRenderFrameFinishedListener: OnRenderFrameFinishedListener)

Remove the render frame finished listener.

Link copied to clipboard
open override fun removeOnRenderFrameStartedListener(onRenderFrameStartedListener: OnRenderFrameStartedListener)

Remove the render frame started listener.

Link copied to clipboard
open override fun removeOnSourceAddedListener(onSourceAddedListener: OnSourceAddedListener)

Remove the source added listener.

Link copied to clipboard
open override fun removeOnSourceDataLoadedListener(onSourceDataLoadedListener: OnSourceDataLoadedListener)

Remove the source data loaded listener.

Link copied to clipboard
open override fun removeOnSourceRemovedListener(onSourceRemovedListener: OnSourceRemovedListener)

Remove the source removed listener.

Link copied to clipboard
open override fun removeOnStyleDataLoadedListener(onStyleDataLoadedListener: OnStyleDataLoadedListener)

Remove the style data loaded listener

Link copied to clipboard
open override fun removeOnStyleImageMissingListener(onStyleImageMissingListener: OnStyleImageMissingListener)

Remove the style image missing listener.

Link copied to clipboard
open override fun removeOnStyleImageUnusedListener(onStyleImageUnusedListener: OnStyleImageUnusedListener)

Remove the style image unused listener.

Link copied to clipboard
open override fun removeOnStyleLoadedListener(onStyleLoadedListener: OnStyleLoadedListener)

Remove the style loaded listener.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun resetFeatureStates(sourceId: String, sourceLayerId: String? = null, callback: FeatureStateOperationCallback): Cancelable

Reset all the feature states within a style source.

Link copied to clipboard
open override fun setBounds(options: CameraBoundsOptions): Expected<String, None>

Set the map bounds.

Link copied to clipboard
open override fun setCamera(cameraOptions: CameraOptions)

Changes the map view by any combination of center, zoom, bearing, and pitch, without an animated transition. The map will retain its current values for any details not passed via the camera options argument. It is not guaranteed that the provided CameraOptions will be set, the map may apply constraints resulting in a different CameraState.

open override fun setCamera(freeCameraOptions: FreeCameraOptions)

Sets the map view with the free camera options.

Link copied to clipboard

Sets the map MapCenterAltitudeMode that defines behavior of the center point altitude for all subsequent camera manipulations.

Link copied to clipboard
open override fun setConstrainMode(constrainMode: ConstrainMode)

Set the map constrain mode

Link copied to clipboard
fun setDebug(debugOptions: List<MapDebugOptions>, enabled: Boolean)

Set debug options

Link copied to clipboard
fun setFeatureState(sourceId: String, sourceLayerId: String? = null, featureId: String, state: Value, callback: FeatureStateOperationCallback): Cancelable

Updates the state object of a feature within a style source.

Link copied to clipboard
open override fun setGestureInProgress(inProgress: Boolean)

Tells the map rendering engine that there is currently a gesture in progress. This affects how the map renders labels, as it will use different texture filters if a gesture is ongoing.

Link copied to clipboard
open override fun setNorthOrientation(northOrientation: NorthOrientation)

Set the map north orientation

Link copied to clipboard

Set the prefetch zoom delta

Link copied to clipboard
fun setRenderWorldCopies(renderWorldCopies: Boolean)

Sets whether multiple copies of the world will be rendered side by side beyond -180 and 180 degrees longitude. If disabled, when the map is zoomed out far enough that a single representation of the world does not fill the map's entire container, there will be blank space beyond 180 and -180 degrees longitude. In this case, features that cross 180 and -180 degrees longitude will be cut in two (with one portion on the right edge of the map and the other on the left edge of the map) at every zoom level.

Link copied to clipboard
open fun setStyleAtmosphere(properties: Value): Expected<String, None>
Link copied to clipboard
Link copied to clipboard
open fun setStyleCustomGeometrySourceTileData(sourceId: String, tileId: CanonicalTileID, featureCollection: MutableList<Feature>): Expected<String, None>
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open fun setStyleImportConfigProperty(importId: String, config: String, value: Value): Expected<String, None>
Link copied to clipboard
open fun setStyleLayerProperties(layerId: String, properties: Value): Expected<String, None>
Link copied to clipboard
open fun setStyleLayerProperty(layerId: String, property: String, value: Value): Expected<String, None>
Link copied to clipboard
open fun setStyleLightProperty(id: String, property: String, value: Value): Expected<String, None>
Link copied to clipboard
open fun setStyleLights(lights: Value): Expected<String, None>
Link copied to clipboard
open fun setStyleProjection(properties: Value): Expected<String, None>
Link copied to clipboard
Link copied to clipboard
open fun setStyleSourceProperties(sourceId: String, properties: Value): Expected<String, None>
Link copied to clipboard
open fun setStyleSourceProperty(sourceId: String, property: String, value: Value): Expected<String, None>
Link copied to clipboard
open fun setStyleTerrain(properties: Value): Expected<String, None>
Link copied to clipboard
open fun setStyleTerrainProperty(property: String, value: Value): Expected<String, None>
Link copied to clipboard
open fun setStyleTransition(transitionOptions: TransitionOptions)
Link copied to clipboard
fun setTileCacheBudget(tileCacheBudget: TileCacheBudget?)

The tile cache budget hint to be used by the map. The budget can be given in tile units or in megabytes. A Map will do the best effort to keep memory allocations for a non essential resources within the budget.

Link copied to clipboard
open override fun setUserAnimationInProgress(inProgress: Boolean)

Tells the map rendering engine that the animation is currently performed by the user (e.g. with a setCamera() calls series). It adjusts the engine for the animation use case. In particular, it brings more stability to symbol placement and rendering.

Link copied to clipboard
open override fun setViewportMode(viewportMode: ViewportMode)

Set the map viewport mode

Link copied to clipboard

Enable real-time collection of map rendering performance statistics, for development purposes. Use after render() has been called for the first time.

Link copied to clipboard

Disable performance statistics collection.

Link copied to clipboard
open fun styleLayerExists(layerId: String): Boolean
Link copied to clipboard
open fun styleSourceExists(sourceId: String): Boolean
Link copied to clipboard
open override fun subscribeCameraChanged(cameraChangedCallback: CameraChangedCallback): Cancelable

Subscribes to CameraChanged event.

Link copied to clipboard
open override fun subscribeGenericEvent(eventName: String, genericEventCallback: GenericEventCallback): Cancelable

Subscribes to an experimental GenericEvent event.

Link copied to clipboard
open override fun subscribeMapIdle(mapIdleCallback: MapIdleCallback): Cancelable

Subscribes to MapIdle event.

Link copied to clipboard
open override fun subscribeMapLoaded(mapLoadedCallback: MapLoadedCallback): Cancelable

Subscribes to MapLoaded event.

Link copied to clipboard
open override fun subscribeMapLoadingError(mapLoadingErrorCallback: MapLoadingErrorCallback): Cancelable

Subscribes to MapLoadingError event.

Link copied to clipboard
open override fun subscribeRenderFrameFinished(renderFrameFinishedCallback: RenderFrameFinishedCallback): Cancelable

Subscribes to RenderFrameFinished event.

Link copied to clipboard
open override fun subscribeRenderFrameStarted(renderFrameStartedCallback: RenderFrameStartedCallback): Cancelable

Subscribes to RenderFrameStarted event.

Link copied to clipboard
open override fun subscribeResourceRequest(resourceRequestCallback: ResourceRequestCallback): Cancelable

Subscribes to ResourceRequest event.

Link copied to clipboard
open override fun subscribeSourceAdded(sourceAddedCallback: SourceAddedCallback): Cancelable

Subscribes to SourceAdded event.

Link copied to clipboard
open override fun subscribeSourceDataLoaded(sourceDataLoadedCallback: SourceDataLoadedCallback): Cancelable

Subscribes to SourceDataLoaded event.

Link copied to clipboard
open override fun subscribeSourceRemoved(sourceRemovedCallback: SourceRemovedCallback): Cancelable

Subscribes to SourceRemoved event.

Link copied to clipboard
open override fun subscribeStyleDataLoaded(styleDataLoadedCallback: StyleDataLoadedCallback): Cancelable

Subscribes to StyleDataLoaded event.

Link copied to clipboard
open override fun subscribeStyleImageMissing(styleImageMissingCallback: StyleImageMissingCallback): Cancelable

Subscribes to StyleImageMissing event.

Link copied to clipboard
open override fun subscribeStyleImageRemoveUnused(styleImageRemoveUnusedCallback: StyleImageRemoveUnusedCallback): Cancelable

Subscribes to StyleImageRemoveUnused event.

Link copied to clipboard
open override fun subscribeStyleLoaded(styleLoadedCallback: StyleLoadedCallback): Cancelable

Subscribes to StyleLoaded event.

Link copied to clipboard

Returns tileIDs that cover current map camera

Link copied to clipboard

Triggers a repaint of the map.

Link copied to clipboard
open override fun unproject(coordinate: MercatorCoordinate, zoomScale: Double): Point

Calculate a coordinate for a given point on the map in Mercator Projection.

Link copied to clipboard
open fun updateGeoJSONSourceFeatures(sourceId: String, dataId: String, features: List<Feature>): Expected<String, None>
Link copied to clipboard
Link copied to clipboard
open fun updateStyleImportWithJSON(importId: String, json: String, config: HashMap<String, Value>?): Expected<String, None>
Link copied to clipboard
open fun updateStyleImportWithURI(importId: String, uri: String, config: HashMap<String, Value>?): Expected<String, None>

Properties

Link copied to clipboard
open override val cameraState: CameraState

Represents current camera state.

Link copied to clipboard
Link copied to clipboard
var style: Style? = null

Style of the map synchronously, will return null is style is not loaded yet.

Link copied to clipboard
Link copied to clipboard
open val styleJSON: String
Link copied to clipboard
Link copied to clipboard
val styleManager: StyleManager
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
open val styleURI: String

Extensions

Link copied to clipboard

Extension function to add an image provided by the Style Extension to the Style.

Link copied to clipboard

Extension function to add 9-patch image provided by the Style Extension to the Style.

fun MapboxStyleManager.addImage9Patch(imageId: String, bitmap: Bitmap, scale: Float = pixelRatio, sdf: Boolean = false): Expected<String, None>

Adds an 9-patch image to be used in the style. X-stretches, Y-stretches and padding will be calculated from Bitmap.getNinePatchChunk.

Link copied to clipboard

Extension function to add a Layer provided by the Style Extension to the Style.

Link copied to clipboard

Extension function to add a Layer provided by the Style Extension to the Style.

Link copied to clipboard

Extension function to add a Layer provided by the Style Extension to the Style.

Link copied to clipboard

Extension function to add a Layer provided by the Style Extension to the Style.

Link copied to clipboard

Extension function to add a model provided by the Style Extension to the Style.

Link copied to clipboard

Add a callback that is invoked when the map is has received a fling gesture. Gesture plugin with id = Plugin.MAPBOX_GESTURES_PLUGIN_ID must be added while constructing MapView as part of MapInitOptions.plugins.

Link copied to clipboard

Add a callback that is invoked when the map is clicked. Gesture plugin with id = Plugin.MAPBOX_GESTURES_PLUGIN_ID must be added while constructing MapView as part of MapInitOptions.plugins.

Link copied to clipboard

Add a callback that is invoked when the map is long clicked. Gesture plugin with id = Plugin.MAPBOX_GESTURES_PLUGIN_ID must be added while constructing MapView as part of MapInitOptions.plugins.

Link copied to clipboard

Add a callback that is invoked when the map is moved. Gesture plugin with id = Plugin.MAPBOX_GESTURES_PLUGIN_ID must be added while constructing MapView as part of MapInitOptions.plugins.

Link copied to clipboard

Add a callback that is invoked when the map is rotated. Gesture plugin with id = Plugin.MAPBOX_GESTURES_PLUGIN_ID must be added while constructing MapView as part of MapInitOptions.plugins.

Link copied to clipboard

Add a callback that is invoked when the map is scaled. Gesture plugin with id = Plugin.MAPBOX_GESTURES_PLUGIN_ID must be added while constructing MapView as part of MapInitOptions.plugins.

Link copied to clipboard

Add a callback that is invoked when the map is shoved. Gesture plugin with id = Plugin.MAPBOX_GESTURES_PLUGIN_ID must be added while constructing MapView as part of MapInitOptions.plugins.

Link copied to clipboard

Add layer to the style persistently.

Link copied to clipboard

Extension function to add a Source provided by the Style Extension to the Style.

Link copied to clipboard
suspend fun MapboxMap.awaitCameraForCoordinates(coordinates: List<Point>, camera: CameraOptions, coordinatesPadding: EdgeInsets? = null, maxZoom: Double? = null, offset: ScreenCoordinate? = null): CameraOptions

Convenience method that returns the CameraOptions object for given parameters.

Link copied to clipboard

Load a new style from a style extension, suspends until style is loaded.

suspend fun MapboxMap.awaitLoadStyle(style: String): Style

Load a new style from a style URI or JSON, suspends until style is loaded.

Link copied to clipboard
suspend fun MapboxMap.awaitStyle(): Style

Get the Style of the map.

Link copied to clipboard
suspend fun MapboxMap.cameraForCoordinates(coordinates: List<Point>, camera: CameraOptions, coordinatesPadding: EdgeInsets? = null, maxZoom: Double? = null, offset: ScreenCoordinate? = null): CameraOptions

Convenience method that returns the CameraOptions object for given parameters.

Link copied to clipboard
fun MapPluginExtensionsDelegate.easeTo(cameraOptions: CameraOptions, animationOptions: MapAnimationOptions? = null, animatorListener: Animator.AnimatorListener? = null): Cancelable

Extension easeTo() for MapPluginExtensionsDelegate Ease the map camera to a given camera options and animation options

Link copied to clipboard
fun MapPluginExtensionsDelegate.flyTo(cameraOptions: CameraOptions, animationOptions: MapAnimationOptions? = null, animatorListener: Animator.AnimatorListener? = null): Cancelable

Extension flyTo() function for MapPluginExtensionsDelegate Fly the map camera to a given camera options.

Link copied to clipboard
Link copied to clipboard

Extension function to get the atmosphere provided by the Style Extension.

Link copied to clipboard
suspend fun MapboxMap.getFeatureState(sourceId: String, sourceLayerId: String? = null, featureId: String): Expected<String, Value>

Get the state map of a feature within a style source.

Link copied to clipboard
suspend fun MapboxMap.getGeoJsonClusterChildren(sourceIdentifier: String, cluster: Feature): Expected<String, FeatureExtensionValue>

Returns the children (original points or clusters) of a cluster (on the next zoom level) given its id (cluster_id value from feature properties) from a GeoJsonSource.

Link copied to clipboard
suspend fun MapboxMap.getGeoJsonClusterExpansionZoom(sourceIdentifier: String, cluster: Feature): Expected<String, FeatureExtensionValue>

Returns the zoom on which the cluster expands into several children (useful for "click to zoom" feature) given the cluster's cluster_id (cluster_id value from feature properties) from a GeoJsonSource.

Link copied to clipboard
suspend fun MapboxMap.getGeoJsonClusterLeaves(sourceIdentifier: String, cluster: Feature, limit: Long, offset: Long): Expected<String, FeatureExtensionValue>

Returns all the leaves (original points) of a cluster (given its cluster_id) from a GeoJsonSource, with pagination support: limit is the number of leaves to return (set to Infinity for all points), and offset is the amount of points to skip (for pagination).

Link copied to clipboard
fun MapPluginExtensionsDelegate.getGesturesManager(): AndroidGesturesManager?

Get the current configured AndroidGesturesManager. Gesture plugin with id = Plugin.MAPBOX_GESTURES_PLUGIN_ID must be added while constructing MapView as part of MapInitOptions.plugins.

Link copied to clipboard

Extension function to get a Layer provided by the Style Extension by layer id.

Link copied to clipboard
inline fun <T : Layer> MapboxStyleManager.getLayerAs(layerId: String): T?

Tries to cast the Layer to T.

Link copied to clipboard

Extension function to get 3D Light that has been applied to the style.

Link copied to clipboard

Extension function to get the projection provided by the Style Extension.

Link copied to clipboard

Extension function to get a Source provided by the Style Extension by source id.

Link copied to clipboard
inline fun <T : Source> MapboxStyleManager.getSourceAs(sourceId: String): T?

Tries to cast the Source to T.

Link copied to clipboard

Extension function to get the terrain provided by the Style Extension.

Link copied to clipboard

Extension function to localize style labels

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun MapPluginExtensionsDelegate.moveBy(screenCoordinate: ScreenCoordinate, animationOptions: MapAnimationOptions? = null, animatorListener: Animator.AnimatorListener? = null): Cancelable

Extension moveBy() function for MapPluginExtensionsDelegate Move the map by a given screen coordinate with optional animation.

Link copied to clipboard
fun MapPluginExtensionsDelegate.pitchBy(pitch: Double, animationOptions: MapAnimationOptions? = null, animatorListener: Animator.AnimatorListener? = null): Cancelable

Extension pitchBy() function for MapPluginExtensionsDelegate Pitch the map by with optional animation.

Link copied to clipboard

Queries the map for rendered features.

Link copied to clipboard

Queries the map for source features.

Link copied to clipboard

Removes atmosphere from style if it was set.

Link copied to clipboard
suspend fun MapboxMap.removeFeatureState(sourceId: String, sourceLayerId: String? = null, featureId: String, stateKey: String? = null): Expected<String, None>

Removes entries from a feature state object.

Link copied to clipboard

Remove a callback that is invoked when the map is has received a fling gesture. Gesture plugin with id = Plugin.MAPBOX_GESTURES_PLUGIN_ID must be added while constructing MapView as part of MapInitOptions.plugins.

Link copied to clipboard

Remove a callback that is invoked when the map is clicked. Gesture plugin with id = Plugin.MAPBOX_GESTURES_PLUGIN_ID must be added while constructing MapView as part of MapInitOptions.plugins.

Link copied to clipboard

Remove a callback that is invoked when the map is long clicked. Gesture plugin with id = Plugin.MAPBOX_GESTURES_PLUGIN_ID must be added while constructing MapView as part of MapInitOptions.plugins.

Link copied to clipboard

Remove a callback that is invoked when the map is moved. Gesture plugin with id = Plugin.MAPBOX_GESTURES_PLUGIN_ID must be added while constructing MapView as part of MapInitOptions.plugins.

Link copied to clipboard

Remove a callback that is invoked when the map is rotated. Gesture plugin with id = Plugin.MAPBOX_GESTURES_PLUGIN_ID must be added while constructing MapView as part of MapInitOptions.plugins.

Link copied to clipboard

Remove a callback that is invoked when the map is scaled. Gesture plugin with id = Plugin.MAPBOX_GESTURES_PLUGIN_ID must be added while constructing MapView as part of MapInitOptions.plugins.

Link copied to clipboard

Remove a callback that is invoked when the map is shoved. Gesture plugin with id = Plugin.MAPBOX_GESTURES_PLUGIN_ID must be added while constructing MapView as part of MapInitOptions.plugins.

Link copied to clipboard

Removes terrain from style if it was set.

Link copied to clipboard
suspend fun MapboxMap.resetFeatureStates(sourceId: String, sourceLayerId: String? = null): Expected<String, None>

Reset all the feature states within a style source.

Link copied to clipboard

Extension rotateBy() function for MapPluginExtensionsDelegate Rotate the map by with optional animation.

Link copied to clipboard
fun MapPluginExtensionsDelegate.scaleBy(amount: Double, screenCoordinate: ScreenCoordinate?, animationOptions: MapAnimationOptions? = null, animatorListener: Animator.AnimatorListener? = null): Cancelable

Extension scaleBy() function for MapPluginExtensionsDelegate Scale the map by with optional animation.

Link copied to clipboard

Extension function to set the Atmosphere provided by the Style Extension to the Style.

Link copied to clipboard
suspend fun MapboxMap.setFeatureState(sourceId: String, sourceLayerId: String? = null, featureId: String, state: Value): Expected<String, None>

Updates the state object of a feature within a style source.

Link copied to clipboard
fun MapPluginExtensionsDelegate.setGesturesManager(androidGesturesManager: AndroidGesturesManager, attachDefaultListeners: Boolean, setDefaultMutuallyExclusives: Boolean)

Set the AndroidGesturesManager instance. Gesture plugin with id = Plugin.MAPBOX_GESTURES_PLUGIN_ID must be added while constructing MapView as part of MapInitOptions.plugins.

Link copied to clipboard
fun MapboxStyleManager.setLight(ambientLight: AmbientLight, directionalLight: DirectionalLight)

Extension function to add dynamic light to the Style. dynamic light is built from AmbientLight and DirectionalLight.

Extension function to add the FlatLight to the Style.

Link copied to clipboard

Extension function to add list of lights.

Link copied to clipboard

Extension function to set the Projection provided by the Style Extension to the Style.

Link copied to clipboard

Extension function to set the Terrain provided by the Style Extension to the Style.

Link copied to clipboard
Link copied to clipboard