All Projects → m0nac0 → flutter-maplibre-gl

m0nac0 / flutter-maplibre-gl

Licence: other
A flutter package for showing customizable vector/raster maps with Maplibre GL (forked from tobrun/flutter-mapbox-gl)

Programming Languages

dart
5743 projects
java
68154 projects - #9 most used programming language
swift
15916 projects
ruby
36898 projects - #4 most used programming language
HTML
75241 projects
objective c
16641 projects - #2 most used programming language
kotlin
9241 projects

Projects that are alternatives of or similar to flutter-maplibre-gl

planetiler
Flexible tool to build planet-scale vector tilesets from OpenStreetMap data fast
Stars: ✭ 823 (+1092.75%)
Mutual labels:  vector-tiles, maps
Mapbox Gl Native
Interactive, thoroughly customizable maps in native Android, iOS, macOS, Node.js, and Qt applications, powered by vector tiles and OpenGL
Stars: ✭ 4,091 (+5828.99%)
Mutual labels:  vector-tiles, maps
vue-mapbox-map
A minimalist Vue component wrapping Mapbox GL or MapLibre GL for dynamic interaction!
Stars: ✭ 26 (-62.32%)
Mutual labels:  maps, maplibre
Openmaptiles
OpenMapTiles Vector Tile Schema Implementation
Stars: ✭ 1,175 (+1602.9%)
Mutual labels:  vector-tiles, maps
Tilehut
A modest, but cozy home for your map tiles
Stars: ✭ 132 (+91.3%)
Mutual labels:  vector-tiles, maps
Osmscout Server
Maps server providing tiles, geocoder, and router
Stars: ✭ 105 (+52.17%)
Mutual labels:  vector-tiles, maps
Editor
An open source visual editor for the 'Mapbox Style Specification'
Stars: ✭ 1,167 (+1591.3%)
Mutual labels:  vector-tiles, maps
Mapbox Gl Native Android
Interactive, thoroughly customizable maps in native Android powered by vector tiles and OpenGL
Stars: ✭ 135 (+95.65%)
Mutual labels:  vector-tiles, maps
openstreetmap-carto-vector-tiles
A general-purpose OpenStreetMap mapnik style, in CartoCSS, served with vector tiles
Stars: ✭ 46 (-33.33%)
Mutual labels:  vector-tiles, maps
ember-google-maps
A friendly Ember addon for working with Google Maps.
Stars: ✭ 93 (+34.78%)
Mutual labels:  maps
umeng analytics plugin
Flutter 版友盟统计插件
Stars: ✭ 20 (-71.01%)
Mutual labels:  flutter-plugin
openstreetmap-americana
A quintessentially American map style
Stars: ✭ 89 (+28.99%)
Mutual labels:  maps
all-transit
Interactive visualization of all transit in the Transitland database
Stars: ✭ 22 (-68.12%)
Mutual labels:  vector-tiles
tmap-book
A book on elegant and informative maps with the tmap package
Stars: ✭ 23 (-66.67%)
Mutual labels:  maps
30DayMapChallenge
My contributions to the #30DayMapChallenge 2019, a daily challenge focusing on spatial visualizations happening throughout November.
Stars: ✭ 170 (+146.38%)
Mutual labels:  maps
get version
Get Version - Get the Version Name, Version Code, Platform and OS Version, and App ID on iOS and Android. Maintainer: @rodydavis
Stars: ✭ 87 (+26.09%)
Mutual labels:  flutter-plugin
expanding bottom bar
BottomNavigationBar for Flutter with expanding titles
Stars: ✭ 39 (-43.48%)
Mutual labels:  flutter-plugin
Some-Calendar
Custom calendar dialog widget for flutter with (multi select, single select, date range) mode
Stars: ✭ 69 (+0%)
Mutual labels:  flutter-plugin
GoogleMapsHelper
An easy to integrate Model Based Google Maps Helper (SVHTTPClient, AFNetworking) That lets you Geo Code , Reverse Geocode, Get Directions , Places Autocomplete.
Stars: ✭ 21 (-69.57%)
Mutual labels:  maps
Free-RASP-Flutter
Flutter library for improving app security and threat monitoring on Android and iOS mobile devices.
Stars: ✭ 62 (-10.14%)
Mutual labels:  flutter-plugin

Flutter Maplibre GL

Flutter CI Generate docs

This Flutter plugin allows to show embedded interactive and customizable vector maps as a Flutter widget.

For the Android and iOS integration, we use maplibre-gl-native. For web, we rely on maplibre-gl-js. This project only supports a subset of the API exposed by these libraries.

This project is a fork of https://github.com/tobrun/flutter-mapbox-gl, replacing its usage of Mapbox GL libraries with the open source Maplibre GL libraries.

Please note that this project is community driven and is not affiliated with the company Mapbox.
It does use some of their amazing open source libraries/tools, though. Thank you, Mapbox, for all the open-source work you do!

Using the plugin in your project

This project is not yet available on pub.dev. You can use it by referencing it in your pubspec.yaml like this:

dependencies:
    ...
    maplibre_gl:
      git:
        url: https://github.com/m0nac0/flutter-maplibre-gl.git
        ref: main

This will get you the very latest changes from the main branch. You can replace main with the name of the latest release to get a more stable version.

Compared to flutter-mapbox-gl, the only breaking API changes are:

  • MapboxMap <--> MaplibreMap
  • MapboxMapController <--> MaplibreMapController

Documentation

Documentation is available on the docs branch in the doc/api folder and automatically updated on each push to the main branch. You can easily preview the documentation / API reference here.

Please visit https://github.com/maplibre/maplibre-gl-js and https://github.com/maplibre/maplibre-gl-native for more information about the Maplibre libraries.

iOS

To use this plugin with iOS, you need to add the source repository and 2 additional pods to your Podfile, as shown in the example app: https://github.com/m0nac0/flutter-maplibre-gl/blob/main/example/ios/Podfile

source 'https://cdn.cocoapods.org/'
source 'https://github.com/m0nac0/flutter-maplibre-podspecs.git'

pod 'MapLibre'
pod 'MapLibreAnnotationExtension'

Web

Include the following JavaScript and CSS files in the <head> of the web/index.html file.

<script src='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.js'></script>
<link href='https://unpkg.com/maplibre-gl@latest/dist/maplibre-gl.css' rel='stylesheet' />

Supported API

Feature Android iOS Web
Style
Camera
Gesture
User Location
Symbol
Circle
Line
Fill

Map Styles

Map styles can be supplied by setting the styleString in the MapOptions. The following formats are supported:

  1. Passing the URL of the map style. This should be a custom map style served remotely using a URL that start with 'http(s)://'
  2. Passing the style as a local asset. Create a JSON file in the assets and add a reference in pubspec.yml. Set the style string to the relative path for this asset in order to load it into the map.
  3. Passing the style as a local file. create an JSON file in app directory (e.g. ApplicationDocumentsDirectory). Set the style string to the absolute path of this JSON file.
  4. Passing the raw JSON of the map style. This is only supported on Android.

Tile sources requiring an API key

If your tile source requires an API key, we recommend directly specifying a source url with the API key included. For example:

https://tiles.example.com/{z}/{x}/{y}.vector.pbf?api_key={your_key}

Location features

Android

Add the ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION permission in the application manifest android/app/src/main/AndroidManifest.xml to enable location features in an Android application:

<manifest ...
    <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
    <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

Starting from Android API level 23 you also need to request it at runtime. This plugin does not handle this for you. The example app uses the flutter 'location' plugin for this.

iOS

To enable location features in an iOS application:

If you access your users' location, you should also add the following key to ios/Runner/Info.plist to explain why you need access to their location data:

xml ...
    <key>NSLocationWhenInUseUsageDescription</key>
    <string>[Your explanation here]</string>

A possible explanation could be: "Shows your location on the map".

Getting Help

  • Need help with your code?: Check the discussions on this repo or open a new one. Or look for previous questions on the #maplibre tag — or ask a new question.
  • Have a bug to report? Open an issue. If possible, include a full log and information which shows the issue.
  • Have a feature request? Open an issue. Tell us what the feature should do and why you want the feature.

Running in GitHub Codespaces

When you open this project in GitHub Codespaces, you can run the example app on web with the command flutter run -d web-server --web-hostname=0.0.0.0

Codespaces should automatically take care of the necessary port forwarding, so that you can view the running web app on your local device or in a new tab.

Please note: the Docker image used to setup the Codespace is from CirrusCI and sets the Git username and email to CirrusCI default values. You should set these correctly, if you plan on committing from the Codespace.

Fixing common issues

Avoid Android UnsatisfiedLinkError

Update buildTypes in android\app\build.gradle

buildTypes {
    release {
        // other configs
        ndk {
            abiFilters 'armeabi-v7a','arm64-v8a','x86_64', 'x86'
        }
    }
}

iOS app crashes on startup

Please include the NSLocationWhenInUseUsageDescription as described here

Contributing

Feedback and contributions are very welcome!

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].