Package com.mapbox.maps

Types

MapAttributeParser
Link copied to clipboard

Utility class for parsing AttributeSet to MapSettings.

object MapAttributeParser
MapboxConfigurationException
Link copied to clipboard

A MapboxConfigurationException is thrown by MapboxMap when the SDK hasn't been properly initialised.

class MapboxConfigurationException : RuntimeException
MapboxExperimental
Link copied to clipboard

Annotation class to mark API as experimental.

annotation class MapboxExperimental
MapboxMap
Link copied to clipboard

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.

MapControllable
Link copied to clipboard

MapControllable interface is the gateway for public API to talk to the internal map controller.

interface MapControllable
MapInitOptions
Link copied to clipboard

Defines configuration MapInitOptions for a MapboxMap. These options can be used when adding a map to your application programmatically (as opposed to via XML). If you are using a MapFragment, you can pass these options in using the static factory method newInstance(MapboxMapOptions). If you are using a MapView, you can pass these options in using the constructor MapView(Context, MapboxMapOptions). If you add a map using XML, then you can apply these options using custom XML tags.

data class MapInitOptions(context: Context, resourceOptions: ResourceOptions, mapOptions: MapOptions, plugins: List<String>, cameraOptions: CameraOptions?, textureView: Boolean, styleUri: String?, attrs: AttributeSet?)
MapSurface
Link copied to clipboard

A MapSurface provides an embeddable map interface. You use this class to display map information and to manipulate the map contents from your application. You can center the map on a given coordinate, specify the size of the area you want to display, and style the features of the map to fit your application's use case.

Use of MapSurface requires a Mapbox API access token. Obtain an access token on the Mapbox account page.

<strong>Warning:</strong> Please note that you are responsible for getting permission to use the map data, and for ensuring your use adheres to the relevant terms of use.

class MapSurface(context: Context, surface: Surface, mapInitOptions: MapInitOptions) : MapPluginProviderDelegate, MapControllable
MapView
Link copied to clipboard

A MapView provides an embeddable map interface. You use this class to display map information and to manipulate the map contents from your application. You can center the map on a given coordinate, specify the size of the area you want to display, and style the features of the map to fit your application's use case.

Use of MapView requires a Mapbox API access token. Obtain an access token on the Mapbox account page.

<strong>Warning:</strong> Please note that you are responsible for getting permission to use the map data, and for ensuring your use adheres to the relevant terms of use.

open class MapView : FrameLayout, MapPluginProviderDelegate, MapControllable
ResourceOptionsManager
Link copied to clipboard

Convenience class that manages a global ResourceOptions It's possible to create ResourceOptionsManager instances as you need them, however it's convenient to use the default object (default).

data class ResourceOptionsManager(resourceOptions: ResourceOptions)
SnapshotCreatedListener
Link copied to clipboard

Interface for getting snapshot when it's finished.

fun fun interface SnapshotCreatedListener
SnapshotStyleListener
Link copied to clipboard

Interface for getting all style related events for snapshotter.

interface SnapshotStyleListener
Snapshotter
Link copied to clipboard

Snapshotter is high-level component responsible for taking map snapshot with given MapSnapshotOptions.

open class Snapshotter
Style
Link copied to clipboard

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 getStyleAsync() method on MapboxMap.

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

class Style : StyleInterface

Functions

applyDefaultParams
Link copied to clipboard

Get a default MapOptions.Builder with reasterization mode GlyphsRasterizationMode#ALL_GLYPHS_RASTERIZED_LOCALLY

fun MapOptions.Builder.applyDefaultParams(context: Context): MapOptions.Builder

Get a default ResourceOptions.Builder with Mapbox pre-defined options, and with the access token taken from the Android resources(if available).

fun ResourceOptions.Builder.applyDefaultParams(context: Context): ResourceOptions.Builder
bitmap
Link copied to clipboard

Extension function to obtain Bitmap from snapshotter converted from Image.

fun MapSnapshotInterface.bitmap(): Bitmap
equalsWithDelta
Link copied to clipboard

Extension function to compare two double with delta.

fun Double.equalsWithDelta(other: Double, delta: Double): Boolean
roughlyEquals
Link copied to clipboard

Extension function to compare two double with default delta of 1E-5.

fun Double.roughlyEquals(other: Double): Boolean
setDisabled
Link copied to clipboard

Set render cache size to 0MB in order to disable it.

fun RenderCacheOptions.Builder.setDisabled(): RenderCacheOptions.Builder
setLargeSize
Link copied to clipboard

Set render cache size to large(128MB).

Works best with devices powerful GPUs, or devices with pixel ratio 1.0.

fun RenderCacheOptions.Builder.setLargeSize(): RenderCacheOptions.Builder
setSmallSize
Link copied to clipboard

Set render cache size to small(64MB).

Works best with devices with not so powerful GPUs, or devices with pixel ratio of 1.0.

fun RenderCacheOptions.Builder.setSmallSize(): RenderCacheOptions.Builder
toCameraOptions
Link copied to clipboard

Extension function to convert CameraState to CameraOptions.

If anchor is specified - CameraOptions.center will be explicitly set to NULL in order for the anchor to apply to the map camera.

fun CameraState.toCameraOptions(anchor: ScreenCoordinate?): CameraOptions
toJson
Link copied to clipboard

Extension function to compare two double with default delta of 1E-5.

fun Value.toJson(): String

Properties

MAPBOX_ACCESS_TOKEN_RESOURCE_NAME
Link copied to clipboard

Resource name used to lookup the Mapbox access token.

const val MAPBOX_ACCESS_TOKEN_RESOURCE_NAME: String
MAPBOX_LOCALE
Link copied to clipboard

Default Locale for data processing (ex: String.toLowerCase(com.mapbox.maps.getMAPBOX_LOCALE, "foo"))

val MAPBOX_LOCALE: Locale