Mapbox Maps SDK for Android

repository·main·Indexed 20 days ago

https://github.com/mapbox/mapbox-maps-android

A native Android library for rendering interactive, customizable maps using OpenGL, Mapbox Style Specifications, and Mapbox Vector Tiles. The SDK includes extensions for Android Auto, providing integration with CarAppService and navigation templates, as well as a Jetpack Compose extension for integrating maps into Compose-based UI architectures using Composable functions like MapboxMap and MapViewportState.

Tokens
22.8K
Snippets
66
Records
91
Agent score
69%

What's inside mapbox-maps-android

  1. Overview of Mapbox Maps Compose Extension

    main
    The Mapbox Maps Compose Extension is a public library designed to integrate the Mapbox Maps SDK with the Jetpack Compose UI framework. It provides high-level Composable functions and lifecycle-aware effects to manage map state, annotations, and camera movements within a Compose-based application architecture.
  2. Overview of the Mapbox Maps Attribution Plugin

    main

    The Mapbox Maps Attribution Plugin for Android is a public library that displays map attribution on top of a MapView.

    Default Behavior:

    • Displays an 'i'-icon in the bottom-left corner of the map.
    • When clicked, it opens an attribution dialog listing all attributions for the currently loaded map style.
    • Includes links to Improve this map and Telemetry settings.

    For more details on displaying source attribution, refer to the Mapbox documentation.

  3. Overview of the Mapbox Maps Compass Plugin

    main

    The Mapbox Maps Compass Plugin for Android is a public library used to display a compass on top of a MapView.

    Default Behavior:

    • The compass appears in the top-right corner of the map.
    • It becomes visible and points to North only when the map is rotated.
    • When clicked, the map resets to face North and the compass disappears.
  4. Overview of Mapbox Maps Annotation Plugin

    main
    The Mapbox Maps Annotation Plugin for Android is a public library designed for displaying various annotation types—including Line, Circle, Symbol, and Fill—on top of a MapView. It integrates with the Mapbox Maps Plugin System to provide managed layers for interactive or static map decorations.
  5. Overview of the Mapbox Maps Indoor Selector Plugin

    main

    The Mapbox Maps Indoor Selector Plugin for Android provides a UI component for navigating between different floors in indoor maps.

    Key Behaviors:

    • Automatic Visibility: The selector appears in the top-right corner only when indoor map data is available in the current map view.
    • Navigation: Users can tap the selector to switch between available floors.
    • Integration: It functions as a plugin within the Mapbox Maps SDK plugin system.
  6. How Mapbox Maps Animation Plugin works

    main

    The plugin provides a way to animate various camera properties of a MapboxMap, including:

    • center: The lng-lat point of the camera center.
    • zoom: The zoom level.
    • bearing: The rotation of the map.
    • pitch: The tilt of the map.
    • anchor: Screen coordinates relative to camera movement.
    • padding: Map padding.

    Animations are powered by Android ValueAnimators that extend the CameraAnimator class. The plugin offers three levels of abstraction (High, Medium, and Low) depending on whether you want ready-to-use functions, managed composition of multiple animators, or manual lifecycle control.

  7. How the MapOverlay Plugin works

    main

    The MapOverlay Plugin allows you to add overlay views on top of a MapView. To prevent these overlays from obscuring important Points of Interest (POIs), the plugin uses a MapOverlayCoordinatesProvider to identify safe coordinates.

    By providing the EdgeInsets (margins) of your overlay views, the plugin can automatically adjust the camera's center location and zoom level to ensure the provided coordinates remain visible and unobstructed by the overlays.

  8. How ViewportStates and ViewportTransitions work together

    main

    The Viewport Plugin manages the map camera by moving it between different states using transitions. At any time, the viewport is in one of three modes:

    1. idle: The camera is not being managed by the plugin.
    2. in a state: The camera is being managed by a ViewportState (e.g., following a user or showing an overview).
    3. transitioning: The camera is currently moving between states via a ViewportTransition.

    To change the camera behavior, you define a ViewportState (what the camera should look like) and a ViewportTransition (how the camera should move to get there). You then call transitionTo() on the viewportPlugin to execute the change.