MapLibre GL Native: open-source mobile SDK for Android and iOS
Published Jun 04, 2021
Introducing a new open-source map library for both Android and iOS - developed by MapTiler team in cooperation with Amazon, Facebook, Microsoft, and MapLibre community. With the MapLibre SDK, developers can write native applications for any mobile device. Community management ensures it stays free forever.
Free alternative to Mapbox Maps SDKs
MapLibre Native is a library for mobile devices that allows developers to display vector maps in their applications. It is an alternative to Google Maps SDK for Android and Apple MapKit on iOS for developers who need advanced functionality like custom map styles, integrating their own business data, and more.
The need for an independent mobile SDK emerged when Mapbox decided to discontinue the development of open-source mobile map SDKs for Android & iOS in the middle of 2020. MapTiler took over the reins, in December 2020 forked the last version released under the OSS license, and soon released it under the MapLibre brand.
MapLibre Native is backward compatible with the latest open-source version of Mapbox SDK (therefore migration of your apps is a few lines of code change), however, there are things specific to MapLibre SDK:
- Tracking of end-users (telemetry) has been removed
- OSS license: community ownership ensures it stays open-source forever
- Updated distribution model: the library is now distributed via the Maven Central repository for Android and as a Swift package for iOS
- Optional usage of authorization: access token requirement depended on the map provider and its policy
The native map SDKs for Android and iOS are built on top of the core C++ library (written in C++14) that powers customizable vector maps by taking stylesheets that conform to the Mapbox Style Specification, applying them to vector tiles, and rendering them using OpenGL or Metal.
To make interactive maps available for native applications on Android and iOS, the core library is packaged into platform-specific SDK. Components from the core library are wrapped by adapters written in platform language (Objective C, Java, …) and exposed in the public API to application developers.
Building Apps for Android and iOS With MapLibre SDK
The MapLibre SDK for Android and iOS allows embedding interactive vector maps that conform to Mapbox style specification into any Android and iOS application where developers need customizable and interactive maps. The SDK along with MapTiler Cloud makes it possible to add additional layers, visualize 3rd party data, fine-tune maps graphical look and feel and implement rich interaction with users.
- Android developers can build their apps in Kotlin or Java.
- The SDK installation consists of adding maven package reference to gradle script and implementing activity/fragment with MapLibre MapView control. In order to load predefined or custom maps in your app, MapTiler Cloud can be used - just create an account and get your API key for FREE. cloud.maptiler.com/account/keys
- Check out “get started” tutorial: docs.maptiler.com/maplibre-gl-native-android/android-basic-get-started/
- Learn more on MapTiler documentation for Android docs.maptiler.com/maplibre-gl-native-android
- iOS developers can implement their apps in Swift or Objective-C and use either interface builder or SwiftUI.
- The SDK installation consists of adding Swift packages to the project and using MapView MapView control in the user interface. In order to load predefined or custom maps in your app, MapTiler Cloud can be used - just create an account and get your API key for FREE. cloud.maptiler.com/account/keys
- Check out “get started” tutorial:
- Learn more on MapTiler documentation for iOS docs.maptiler.com/maplibre-gl-native-ios
Partnership with Amazon, Facebook, Microsoft, and the MapLibre community
The MapLibre community consists of many individuals and companies. MapTiler, Amazon, Facebook, and Microsoft are the most visible ones; Christian Sturm, Jukka Hietanen, Nuno Goncalves, Petr Pokorný, Rob Chohan, Szymon Ulewicz, Yuri Astrakhan count among the most active developers there.
iOS Metal supported and the future
Support for Metal Framework, Apple’s replacement of OpenGL and OpenCL in a single 3D graphic and shader API, is already available in beta version - thanks to great contributions from the Amazon engineers.
The team is also working on configuration improvements that will remove hardcoded Mapbox configuration and will expose the API for application developers to provide custom configuration if needed or to use predefined vector maps providers configuration, which comes with their standard styles so that the developer doesn’t need to look for exact URLs but use just the style name. The ability to fully configure the SDK is also removing obstacles in offline caching for non-mapbox maps in the original mapbox SDK, where non-mapbox resources were cached along with API keys and tile URL subdomains causing duplicates in the offline cache and other problems. Removing these issues will be possible because the backend URL, canonical-to-normalized URL conversion, templates for glyphs, sprites URLs, and so on will be fully configurable.