maplibre-native
MapLibre Native - Interactive vector tile maps for iOS, Android and other platforms.
Top Related Projects
Interactive, thoroughly customizable maps in native Android, iOS, macOS, Node.js, and Qt applications, powered by vector tiles and OpenGL
Vector and raster maps with GL styles. Server side rendering by MapLibre GL Native. Map tile server for MapLibre GL JS, Android, iOS, Leaflet, OpenLayers, GIS via WMTS, etc.
OpenLayers
π JavaScript library for mobile-friendly interactive maps πΊπ¦
WebGL2 powered visualization framework
An open-source JavaScript library for world-class 3D globes and maps :earth_americas:
Quick Overview
MapLibre Native is an open-source mapping library for mobile and desktop platforms. It provides a powerful SDK for rendering interactive maps, similar to Mapbox GL Native, but with a focus on being free and open-source. MapLibre Native supports various platforms including iOS, Android, macOS, and Linux.
Pros
- Free and open-source alternative to proprietary mapping solutions
- Cross-platform support (iOS, Android, macOS, Linux)
- High-performance vector tile rendering
- Active community and regular updates
Cons
- Less extensive documentation compared to some commercial alternatives
- Smaller ecosystem of plugins and extensions
- May require more technical expertise to implement and customize
- Limited official support options
Code Examples
- Initializing a map view (iOS):
import Mapbox
let mapView = MGLMapView(frame: view.bounds)
mapView.styleURL = URL(string: "https://demotiles.maplibre.org/style.json")
view.addSubview(mapView)
- Adding a marker to the map (Android):
val symbolManager = SymbolManager(mapView, mapboxMap, style)
symbolManager.iconAllowOverlap = true
val symbol = SymbolOptions()
.withLatLng(LatLng(40.7128, -74.0060))
.withIconImage("marker-icon")
.withIconSize(1.5f)
symbolManager.create(symbol)
- Changing map style (JavaScript):
map.setStyle('https://demotiles.maplibre.org/style.json');
Getting Started
To get started with MapLibre Native, follow these steps:
-
Add the MapLibre Native dependency to your project:
For iOS (CocoaPods):
pod 'Mapbox-iOS-SDK', :git => 'https://github.com/maplibre/maplibre-native-ios.git', :tag => 'ios-v5.12.0'
For Android (Gradle):
implementation 'org.maplibre.gl:android-sdk:9.5.2'
-
Initialize a map view in your app:
iOS:
import Mapbox let mapView = MGLMapView(frame: view.bounds) mapView.styleURL = URL(string: "https://demotiles.maplibre.org/style.json") view.addSubview(mapView)
Android:
import com.mapbox.mapboxsdk.Mapbox import com.mapbox.mapboxsdk.maps.MapView val mapView = findViewById<MapView>(R.id.mapView) mapView.getMapAsync { mapboxMap -> mapboxMap.setStyle("https://demotiles.maplibre.org/style.json") }
-
Customize the map and add features as needed using the MapLibre Native SDK.
Competitor Comparisons
Interactive, thoroughly customizable maps in native Android, iOS, macOS, Node.js, and Qt applications, powered by vector tiles and OpenGL
Pros of mapbox-gl-native
- More extensive documentation and examples
- Wider range of supported platforms and devices
- Larger community and ecosystem of tools/plugins
Cons of mapbox-gl-native
- Proprietary license with usage restrictions
- Potential vendor lock-in
- Less flexibility for customization and modification
Code Comparison
mapbox-gl-native:
#include <mbgl/map/map.hpp>
#include <mbgl/style/style.hpp>
mbgl::Map map(view);
map.getStyle().loadJSON(jsonStyle);
map.setCenter(mbgl::LatLng(latitude, longitude));
maplibre-native:
#include <mbgl/map/map.hpp>
#include <mbgl/style/style.hpp>
mbgl::Map map(view);
map.getStyle().loadJSON(jsonStyle);
map.setCenter(mbgl::LatLng(latitude, longitude));
The code structure and API are very similar between the two projects, as MapLibre was forked from Mapbox GL Native. The main differences lie in the project setup, dependencies, and available features rather than the core API usage.
MapLibre Native offers an open-source alternative to Mapbox GL Native, providing similar functionality with more freedom for customization and commercial use. However, it may lack some advanced features and has a smaller ecosystem compared to Mapbox's offering.
Vector and raster maps with GL styles. Server side rendering by MapLibre GL Native. Map tile server for MapLibre GL JS, Android, iOS, Leaflet, OpenLayers, GIS via WMTS, etc.
Pros of tileserver-gl
- Lightweight and easy to set up for serving vector tiles
- Supports multiple data sources and styles out of the box
- Includes a built-in viewer for previewing maps
Cons of tileserver-gl
- Limited to serving tiles and styles, not a full mapping SDK
- Less flexibility for custom rendering and interactions
- Smaller community and fewer extensions compared to maplibre-native
Code Comparison
maplibre-native:
#include <mbgl/map/map.hpp>
#include <mbgl/style/style.hpp>
mbgl::Map map(view);
map.getStyle().loadURL("mapbox://styles/mapbox/streets-v11");
tileserver-gl:
const tileserver = require('tileserver-gl');
const config = {
styles: ['styles/osm-bright/style.json'],
data: { 'osm': { mbtiles: 'data/osm.mbtiles' } }
};
tileserver(config);
While maplibre-native provides a full-featured mapping SDK for rendering and interacting with maps, tileserver-gl focuses on serving vector tiles and styles. maplibre-native offers more control over the map rendering process, while tileserver-gl simplifies the process of setting up a tile server with minimal configuration.
OpenLayers
Pros of OpenLayers
- More comprehensive and feature-rich for web-based mapping applications
- Supports a wider range of data formats and projections
- Larger community and more extensive documentation
Cons of OpenLayers
- Steeper learning curve due to its extensive API
- Larger file size, which may impact load times for web applications
- Less suitable for mobile or native applications compared to MapLibre Native
Code Comparison
OpenLayers:
import Map from 'ol/Map';
import View from 'ol/View';
import TileLayer from 'ol/layer/Tile';
import OSM from 'ol/source/OSM';
const map = new Map({
target: 'map',
layers: [new TileLayer({ source: new OSM() })],
view: new View({ center: [0, 0], zoom: 2 })
});
MapLibre Native:
#include <mbgl/map/map.hpp>
#include <mbgl/style/style.hpp>
auto map = std::make_unique<mbgl::Map>(view, resourceOptions);
map->getStyle().loadJSON(jsonStyle);
map->setCenter(mbgl::LatLng{0, 0});
map->setZoom(2);
Both libraries offer powerful mapping capabilities, but they cater to different use cases. OpenLayers is more suited for web-based applications with complex mapping requirements, while MapLibre Native is better for native mobile and desktop applications that require high performance and offline capabilities.
π JavaScript library for mobile-friendly interactive maps πΊπ¦
Pros of Leaflet
- Lightweight and simple to use, with a gentle learning curve
- Extensive plugin ecosystem for added functionality
- Better suited for basic web mapping applications
Cons of Leaflet
- Limited 3D mapping capabilities
- Less performant with large datasets or complex visualizations
- Fewer built-in advanced features compared to MapLibre Native
Code Comparison
Leaflet:
var map = L.map('map').setView([51.505, -0.09], 13);
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
attribution: 'Β© OpenStreetMap contributors'
}).addTo(map);
MapLibre Native:
var map = new maplibregl.Map({
container: 'map',
style: 'https://demotiles.maplibre.org/style.json',
center: [-0.09, 51.505],
zoom: 13
});
Key Differences
- MapLibre Native offers more advanced features and better performance for complex maps
- Leaflet is easier to set up and use for simple web mapping projects
- MapLibre Native provides better support for vector tiles and 3D mapping
- Leaflet has a larger community and more third-party plugins available
WebGL2 powered visualization framework
Pros of deck.gl
- Highly customizable and extensible WebGL-powered visualization framework
- Supports a wide range of data visualization types, including 3D
- Integrates well with React and other modern web frameworks
Cons of deck.gl
- Steeper learning curve for developers new to WebGL or advanced data visualization
- May have higher performance overhead for simpler map visualizations
- Less focused on traditional mapping features compared to MapLibre Native
Code Comparison
deck.gl:
import {Deck} from '@deck.gl/core';
import {GeoJsonLayer} from '@deck.gl/layers';
new Deck({
layers: [new GeoJsonLayer({id: 'geojson', data: GEOJSON_DATA})]
});
MapLibre Native:
var map = new maplibregl.Map({
container: 'map',
style: 'https://demotiles.maplibre.org/style.json',
center: [-74.5, 40],
zoom: 9
});
Summary
deck.gl is a powerful data visualization library that excels in creating complex, interactive visualizations, particularly for large datasets. It offers more flexibility in terms of custom rendering and data processing. MapLibre Native, on the other hand, is more focused on traditional mapping capabilities and may be easier to set up for basic map applications. The choice between the two depends on the specific requirements of your project, such as the complexity of visualizations needed and the level of customization required.
An open-source JavaScript library for world-class 3D globes and maps :earth_americas:
Pros of Cesium
- Specializes in 3D geospatial visualization, offering advanced terrain rendering and globe-based mapping
- Supports time-dynamic data and animations, ideal for temporal geospatial analysis
- Extensive documentation and active community support
Cons of Cesium
- Steeper learning curve due to its focus on 3D and complex geospatial features
- Larger file size and potentially higher resource consumption compared to 2D-focused libraries
Code Comparison
MapLibre Native (C++):
#include <mbgl/map/map.hpp>
#include <mbgl/style/style.hpp>
mbgl::Map map(view);
map.getStyle().loadJSON(jsonStyle);
map.setCenter(mbgl::LatLng(latitude, longitude));
map.setZoom(zoomLevel);
Cesium (JavaScript):
const viewer = new Cesium.Viewer('cesiumContainer');
viewer.scene.camera.setView({
destination: Cesium.Cartesian3.fromDegrees(longitude, latitude, height),
orientation: {
heading: Cesium.Math.toRadians(heading),
pitch: Cesium.Math.toRadians(pitch),
roll: 0.0
}
});
Both libraries offer powerful mapping capabilities, but Cesium focuses on 3D visualization while MapLibre Native provides a more lightweight 2D mapping solution. Cesium excels in complex geospatial scenarios, while MapLibre Native is better suited for simpler 2D map applications with lower resource requirements.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
MapLibre Native
MapLibre Native is a free and open-source library for publishing maps in your apps and desktop applications on various platforms. Fast displaying of maps is possible thanks to GPU-accelerated vector tile rendering.
This project originated as a fork of Mapbox GL Native, before their switch to a non-OSS license in December 2020. For more information, see: FORK.md
.
Getting Started
To get started with MapLibre Native, go to your platform below.
Documentation
- Android API Documentation, Android Quickstart
- iOS Documentation
- MapLibre Native Markdown Book: architectural notes
- Core C++ API Documentation (unstable)
- Everyone is free to share knowledge and information on the wiki
See below for the platform-specific README.md
files.
Platforms
Platforms with a Γ’ΒΒΓ―ΒΈΒ are MapLibre Core Projects and have a substantial amount of financial resources allocated to them. Learn about the different project tiers.
Renderer Modularization & Metal
MapLibre Native for iOS 6.0.0 with Metal support has been released. See the news announcement.
Contributing
To contribute to MapLibre Native, see CONTRIBUTING.md
and (if applicable) the specific instructions for the platform you want to contribute to.
Getting Involved
Join the #maplibre-native
Slack channel at OSMUS. Get an invite at https://slack.openstreetmap.us/
Bounties Γ°ΒΒΒ°
Thanks to our sponsors, we are able to award bounties to developers making contributions toward certain bounty directions. To get started doing bounties, refer to the step-by-step bounties guide.
We thank everyone who supported us financially in the past and special thanks to the people and organizations who support us with recurring donations!
Read more about the MapLibre Sponsorship Program at https://maplibre.org/sponsors/.
Gold:
Silver:
Backers and Supporters:
License
MapLibre Native is licensed under the BSD 2-Clause License.
Top Related Projects
Interactive, thoroughly customizable maps in native Android, iOS, macOS, Node.js, and Qt applications, powered by vector tiles and OpenGL
Vector and raster maps with GL styles. Server side rendering by MapLibre GL Native. Map tile server for MapLibre GL JS, Android, iOS, Leaflet, OpenLayers, GIS via WMTS, etc.
OpenLayers
π JavaScript library for mobile-friendly interactive maps πΊπ¦
WebGL2 powered visualization framework
An open-source JavaScript library for world-class 3D globes and maps :earth_americas:
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot