Mapbox Map
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
Functions
Add a listener that's going to be invoked whenever map camera changes.
Add a listener that's going to be invoked whenever map has entered the idle state.
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.
Add a listener that's going to be invoked whenever there's a map load error.
Add a listener that's going to be invoked whenever the Map finished rendering a frame.
Add a listener that's going to be invoked whenever the Map started rendering a frame.
Add a listener that's going to be invoked whenever a source has been added with StyleManager#addStyleSource runtime API.
Add a listener that's going to be invoked whenever the source data has been loaded.
Add a listener that's going to be invoked whenever a source has been removed with StyleManager#removeStyleSource runtime API.
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.
Add a listener that's going to be invoked whenever a style has a missing image.
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.
Add a listener that's going to be invoked whenever the requested style has been fully loaded, including the style specified sprite and sources.
Adds a model to be used in the style. This API can also be used for updating a model. If the model for a given modelId
was already added, it gets replaced by the new model.
Call extension function on CameraAnimationsPlugin. In most cases should not be called directly.
Convert to a camera options from a given LatLngBounds, padding, bearing and pitch values.
Convenience method that returns the camera options object for given arguments
Convert to a camera options from a given list of points, padding, bearing and pitch values.
Convert to a camera options from a given geometry, padding, bearing and pitch values.
Clears temporary map data.
Returns the CoordinateBounds for a given camera.
Returns the CoordinateBounds for a given camera.
Returns the coordinate bounds and zoom for a given camera.
Returns the unwrapped coordinate bounds and zoom for a given camera.
Calculate a geographical coordinate(i.e., longitude-latitude pair) that corresponds to a screen coordinate.
Calculate a longitude-latitude pair for a Spherical Mercator projected meters.
Calculate geographical coordinates(i.e., longitude-latitude pair) that corresponds to screen coordinates.
Prepares the drag gesture to use the provided screen coordinate as a pivot point. This function should be called each time when user starts a dragging action (e.g. by clicking on the map). The following dragging will be relative to the pivot.
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:
Call extension function on GesturesPlugin. In most cases should not be called directly.
Get the map bounds options.
Get debug options
Calculates target point where camera should move after drag. The method should be called after dragStart
and before dragEnd
.
Get elevation for given coordinate. Value is available only for the visible region on the screen, if terrain (DEM) tile is available.
Get the state map of a feature within a style source.
Get the map's current free camera options. After mutation, it should be set back to the map.
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.
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.
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).
Get map options.
Calculate distance spanned by one pixel at the specified latitude at current zoom level.
Calculate distance spanned by one pixel at the specified latitude and zoom level.
Get the prefetch zoom delta
Get the current RenderCacheOptions.
Get the ResourceOptions the map was initialized with.
Checks whether a model exists.
Returns if the style has been fully loaded.
Returns if a gesture is in progress.
Returns if user animation is currently in progress.
Load the style from Style Extension.
Load style JSON.
Load style JSON
Will load a new map style asynchronous from the specified URI.
Calculate a screen coordinate that corresponds to a geographical coordinate (i.e., longitude-latitude pair).
Calculate screen coordinates that corresponds to geographical coordinates (i.e., longitude-latitude pair).
Calculate a point on the map in Mercator Projection for a given coordinate at the specified zoom scale.
Calculate Spherical Mercator ProjectedMeters coordinates.
Queries for feature extension values in a GeoJSON source.
Queries the map for rendered features.
Queries the map for source features.
Reduce memory use. Useful to call when the application gets paused or sent to background.
Remove entries from a feature state map.
Remove the camera change listener.
Remove the map idle listener.
Remove the map loaded listener.
Remove the map error listener.
Remove the render frame finished listener.
Remove the render frame started listener.
Remove the source added listener.
Remove the source data loaded listener.
Remove the source removed listener.
Remove the style data loaded listener
Remove the style image missing listener.
Remove the style image unused listener.
Remove the style loaded listener.
Removes a model from the style.
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.
Sets the map view with the free camera options.
Set the map constrain mode
Set debug options
Update the state map of a feature within a style source.
Notify map about gesture being in progress.
The memory 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.
Set the map north orientation
Set the prefetch zoom delta
Enables or disables the experimental render cache feature.
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.
Set the map viewport mode
Subscribes an Observer to a provided list of event types. Observable will hold a strong reference to an \sa Observer instance, therefore, in order to stop receiving notifications, caller must call unsubscribe with an \sa Observer instance used for an initial subscription.
Triggers a repaint of the map.
Calculate a coordinate for a given point on the map in Mercator Projection.
Unsubscribes an Observer from all events.
Unsubscribes an Observer from a provided list of event types.