Skip to content

Display a non-interactive map

Disable interactivity to create a static map.

<!DOCTYPE html>
<html lang="en">
    <title>Display a non-interactive map</title>
    <meta property="og:description" content="Disable interactivity to create a static map." />
    <meta charset='utf-8'>
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel='stylesheet' href='' />
    <script src=''></script>
        body { margin: 0; padding: 0; }
        html, body, #map { height: 100%; }
<div id="map"></div>
    const map = new maplibregl.Map({
        container: 'map',
        center: [-74.5, 40],
        zoom: 9,
        // causes pan & zoom handlers not to be applied, similar to
        // .dragging.disable() and other handler .disable() functions in Leaflet.
        interactive: false