MapLibre for Flutter

repository·main·Indexed 41 days ago

https://github.com/josxha/flutter-maplibre

A high-performance mapping library providing Flutter bindings for MapLibre SDKs across Web, Mobile (Android/iOS), and Desktop (Windows/macOS). It uses native interoperability (FFI/JNI) and the Mapbox Vector Tile (MVT) standard to deliver cross-platform mapping experiences. The library includes platform-specific implementations via maplibre_android, maplibre_ios, maplibre_web, and maplibre_webview.

Tokens
28.9K
Snippets
68
Records
126
Agent score
49%

What's inside MapLibre for Flutter

  1. Overview of MapLibre for Flutter documentation

    main

    The maplibre package provides Flutter bindings to MapLibre Native and MapLibre-GL-JS. The documentation covers the following core areas for integrating and customizing maps:

    • Getting Started: Instructions for integrating the package into your project.
    • Styles: Customizing the visual design of the map.
    • User Interface: Using built-in controls and indicators.
    • Annotations: Adding geometric shapes and markers like Markers, Circles, Polylines, or Polygons.
    • Style Layers: Adding or removing layers to the map for advanced customization.
    • Events: Listening to map interactions, such as clicks.
  2. Overview of MapLibre for Flutter

    main

    MapLibre for Flutter is a modern rewrite of maplibre_gl that provides Flutter bindings for MapLibre SDKs. It uses native interoperability (FFI/JNI) to deliver high-performance, cross-platform mapping experiences based on the Mapbox Vector Tile (MVT) standard.

    Platform Support

    • Web: Uses maplibre-gl-js.
    • Android & iOS: Uses maplibre-native (formerly maplibre-gl).
    • Windows & macOS: Uses maplibre-gl-js via a WebView.
  3. Overview of MapLibre Flutter

    main

    MapLibre Flutter is a modern rewrite of maplibre_gl that provides Flutter bindings for MapLibre SDKs. It uses native interoperability (FFI/JNI) to deliver high-performance, consistent, cross-platform mapping experiences based on the Mapbox Vector Tile (MVT) standard.

    Platform Support & Implementation:

    • Android & iOS: Uses maplibre-native (formerly maplibre-gl) via native bindings.
    • Web: Uses maplibre-gl-js (a fork of mapbox-gl-js).
    • Windows & macOS: Uses maplibre-gl-js via a WebView.
  4. Compare maplibre features with other Flutter map solutions

    main

    Use maplibre when you require a vendor-free, BSD-3-Clause licensed mapping solution that supports Mapbox Vector Tiles (MVT), PMTiles, and Hillshade tiles. Unlike mapbox_maps_flutter or google_maps_flutter, maplibre does not tie you to a specific provider's TOS or usage-based pricing.

    Key Advantages of maplibre:

    • Vendor-Free & Cost-Effective: No per-user or per-use fees; uses BSD-3-Clause license.
    • Advanced Tile Support: Native support for PMTiles, MVT, and Hillshade tiles.
    • Rich Annotation Layers: Supports Widgets, Polygons, Polylines, Circles, Markers, and Heatmaps.
    • Broad Platform Support: Supports Android, iOS, Web, Windows, and macOS (note: Linux is not currently supported).
    • Advanced Capabilities: Includes support for Caching, Offline usage, and User Location (availability may vary by platform).
  5. Explore Map Annotations in flutter-maplibre

    main

    The flutter-maplibre project supports several types of map annotations to visualize data on top of the map layer. You can implement the following annotation types:

    • Circle Annotations: Visualizing point data as circles.
    • Marker Annotations: Using custom icons or markers to represent specific locations.
    • Polygon Annotations: Drawing closed shapes to represent areas.
    • Polyline Annotations: Drawing lines to represent paths or routes.
  6. Explore available Style Layers

    main

    The flutter-maplibre project supports various MapLibre style layers for rendering different types of map data. You can implement and customize the following layer types:

    • Circle Style Layer: For rendering circular points.
    • Fill Extrusion Style Layer: For rendering 3D volumes (e.g., buildings).
    • Fill Style Layer: For rendering filled polygons.
    • Heatmap Style Layer: For rendering density-based heatmaps.
    • Hillshade Style Layer: For rendering terrain shading.
    • Line Style Layer: For rendering lines and paths.
    • Raster Style Layer: For rendering raster tiles.
    • Symbol Style Layer: For rendering icons and text symbols.
  7. Compare maplibre with similar Flutter map packages

    main

    When choosing a mapping package for Flutter, consider the following alternatives to maplibre:

    maplibre_gl

    • Nature: A fork of mapbox_gl and a hosted project under the MapLibre organization.
    • Known Issues: Reported stability issues (app crashes), platform-specific behavior differences between iOS and Android, legacy code/workarounds, and performance bottlenecks due to heavy reliance on platform channels.
    • Web: Requires revision for Flutter WebAssembly compatibility.

    mapbox_maps_flutter

    • Nature: The official Mapbox package for Flutter, wrapping native Mapbox SDKs for Android and iOS.
    • Considerations: It is not vendor-free and is subject to Mapbox Terms of Service, which may impact project suitability.

    flutter_map

    • Nature: A pure Dart implementation with a permissive license.
    • Pros: Excellent cross-platform experience and a robust plugin system.
    • Cons: Performance may be lower than lower-level renderers when handling large datasets or vector tiles (vector tile support requires the vector_map_tiles package).