Skip to content
Make with

MapLibre GL Native Node.jsOfficial

Official Node.js bindings for MapLibre Native

Maintained by MapLibre

MapLibre GL Native Node.js provides official Node.js bindings for MapLibre Native, allowing developers to render maps server-side, generate static map images, and process geospatial data in Node.js applications. Perfect for server-side rendering, tile servers, and headless map generation.

Quick start

npm install @maplibre/maplibre-gl-native sharp
const mbgl = require('@maplibre/maplibre-gl-native');
const sharp = require('sharp');

const map = new mbgl.Map();

fetch('https://tiles.openfreemap.org/styles/liberty')
  .then((res) => res.json())
  .then((style) => {
    map.load(style);

    map.render({ zoom: 1, center: [0, 20] }, (err, buffer) => {
      if (err) throw err;

      map.release();

      // Convert the raw RGBA buffer to PNG
      sharp(buffer, { raw: { width: 512, height: 512, channels: 4 } })
        .toFile('image.png', (err) => {
          if (err) throw err;
        });
    });
  });
›Setup noteschecked with v6.4.1

It renders maps to images on a server. Prebuilt binaries install for Ubuntu 24.04, macOS, and Windows (amd64 and arm64) on Node.js 22, 24, and 26. map.load() takes the style JSON, not a URL, so the style is fetched first. Tiles, glyphs, and sprites load over the network by default; pass a request(req, callback) function to new mbgl.Map() to serve them yourself, for example from disk. render() returns raw RGBA pixels, which sharp turns into a PNG.

Other platforms are on SDKs.