Style
The general class to interact with Styles in the Modular Mapbox Maps SDK for Android. It exposes the entry point for all methods related to the Style. You cannot instantiate Style object directly, rather, you must obtain one from the getStyle(onStyleLoaded) method on MapboxMap.
Note: Similar to a View object, a Style should only be read and modified from the main thread.
Types
A convenience object to access the style ID strings of the professionally-designed map styles made by Mapbox.
Callback to be invoked when a style has finished loading.
Functions
Adds a new style custom layer.
Adds a new style layer.
Adds a custom geometry to be used in the style. To add the data, implement the CustomGeometrySourceOptions.fetchTile@MainThread override function callback in the options and call setStyleCustomGeometrySourceTileData
Adds a new style custom layer.
Note! This is an experimental feature. It can be changed or removed in future versions.
Adds an image to be used in the style. This API can also be used for updating an image. If the image id was already added, it gets replaced by the new image.
Adds new import to current style, loaded from a JSON string.
Adds new import to current style, loaded from an URI.
Adds a new style layer.
Gets the value of a style atmosphere property.
Get an image from the style.
Gets style import config.
Gets the value of style import config.
Returns the existing style imports.
Gets style import schema.
Gets style layer properties.
Gets the value of style layer property.
Gets the value of the style light property.
Gets added lights to the style.
Gets the value of a style projection property.
Gets style source parameters. In order to convert returned value to a json string please take a look at Value.toJson.
Gets the value of style source property.
Get the value of a style terrain property.
Returns the map style's transition options. By default, the style parser will attempt to read the style default transition options, if any, fallbacking to an immediate transition otherwise. Transition options can be overridden via setStyleTransition, but the options are reset once a new style has been loaded.
Checks whether an image exists.
Checks whether a model exists.
Invalidate region for provided custom geometry source.
Invalidate tile for provided custom geometry source.
Checks if a style layer is persistent.
Check if the style is completely loaded.
Moves import to position before another import, specified with beforeId
. Order of imported styles corresponds to order of their layers.
Moves an existing style layer.
Removes an image from the style.
Removes an existing style import.
Removes an existing style layer
Removes a model from the style.
Removes an existing style source.
Sets the style global atmosphere properties.
Set tile data of a custom geometry.
Note! This is an experimental feature. It can be changed or removed in future versions.
Set geojson source data. Call may take significant time for parsing and marshalling depending on the data size.
Sets lights to the style.
Sets the map's projection. If called with null
, the map will reset to Mercator.
Sets style source parameters. This method can be used to perform batch update for a style source parameters. The structure of a provided parameters
value must conform to Style Specification - Sources format for a corresponding source type. Modification of a source type https://docs.mapbox.com/mapbox-gl-js/style-spec/sources/#type is not allowed.
Sets a value to a style source property. Note: When setting the "data" property of a geojson source, this method does not synchronously parse the GeoJSON data. The events API shall be used to make sure the provided GeoJSON data is valid. In case the GeoJSON is valid, a MapLoaded event will be propagated. In case of errors, a MapLoadingError event will be propagated instead.
Sets the style global terrain source properties.
Overrides the map style's transition options with user-provided options.
Checks whether a given style layer exists.
Checks whether a given style source exists.
Updates an existing import in the style. The function replaces the content of the import, with the content loaded from the provided data value. The configuration values of the import are merged with the configuration provided in the update.
Updates an existing import in the style. The function replaces the content of the import, with the content loaded from the provided URI. The configuration values of the import are merged with the configuration provided in the update.
Properties
Extensions
Extension function to add an image provided by the Style Extension to the Style.
Extension function to add 9-patch image provided by the Style Extension to the Style.
Adds an 9-patch image to be used in the style. X-stretches, Y-stretches and padding will be calculated from Bitmap.getNinePatchChunk.
Extension function to add a Layer provided by the Style Extension to the Style.
Extension function to add a Layer provided by the Style Extension to the Style.
Extension function to add a Layer provided by the Style Extension to the Style.
Extension function to add a Layer provided by the Style Extension to the Style.
Extension function to add a model provided by the Style Extension to the Style.
Add layer to the style persistently.
Extension function to add a Source provided by the Style Extension to the Style.
Extension function to get the atmosphere provided by the Style Extension.
Extension function to get a Layer provided by the Style Extension by layer id.
Tries to cast the Layer to T.
Extension function to get 3D Light that has been applied to the style.
Extension function to get the projection provided by the Style Extension.
Extension function to get a Source provided by the Style Extension by source id.
Tries to cast the Source to T.
Extension function to get the terrain provided by the Style Extension.
Extension function to localize style labels
Removes atmosphere from style if it was set.
Removes terrain from style if it was set.
Extension function to set the Atmosphere provided by the Style Extension to the Style.
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.
Extension function to add list of lights.
Extension function to set the Projection provided by the Style Extension to the Style.
Extension function to set the Terrain provided by the Style Extension to the Style.