MapLibre Native Rust provides official Rust bindings for MapLibre Native, bringing high-performance vector map rendering to Rust applications. Built with safety and performance in mind, it enables Rust developers to integrate interactive maps into desktop applications, servers, and embedded systems.
Quick start
cargo add maplibre_nativeuse maplibre_native::{CameraUpdate, Image, ImageRendererBuilder, LatLng};
use std::num::NonZeroU32;
fn main() {
let mut renderer = ImageRendererBuilder::new()
.with_size(NonZeroU32::new(512).unwrap(), NonZeroU32::new(512).unwrap())
.build_static_renderer();
renderer.load_style_from_url(&"https://tiles.openfreemap.org/styles/liberty".parse().unwrap());
let camera = CameraUpdate::new()
.center(LatLng { lat: 0.0, lng: 0.0 })
.zoom(0.0);
let image: Image = renderer.render_static(&camera).unwrap();
image.as_image().save("map.png").unwrap();
}›Setup noteschecked with v0.9.3
It renders maps to images. The build downloads and compiles MapLibre Native, so you need a C++ toolchain, CMake, and system libraries such as curl, libuv, ICU, libpng, libjpeg-turbo, and libwebp. Pick the graphics backend with a feature: vulkan by default on Linux and Windows, metal on macOS, or opengl. Linux and macOS are tested; Windows is not yet supported. Requires Rust 1.90 or newer.
Other platforms are on SDKs.
